一 进行授权页
浏览器输入http://localhost:8081/oauth/authorize?response_type=code&redirect_uri=http://localhost:8081/callback&client_id=android1&scop=all
二 使用资源站用户登陆
自动跨到资源登陆页,先登陆
三 授权资源类型
登陆成功后,去授权你的资源,这些资源是在AuthorizationServerConfig.configure方法里配置的
clients.inMemory()
.withClient(ClientID)
.secret(passwordEncoder.encode(ClientSecret))
.authorizedGrantTypes("authorization_code", "refresh_token", "password", "implicit")
.scopes("read","write","del","userinfo")
.redirectUris(RedirectURLs);
}
四 接到code
授权之后,系统会重定向到你的redirect_uri这个页面,并带上唯一的code
五 获取access_token
我们拿着code就要再去授权服务器去获取token了,你可以在你的代码里写这个,也可以手动拿着code,去拼成一个urlÿ