More comments

0.6
LSZ 8 years ago
parent e796269523
commit 1cc7f67d5c

@ -1,5 +1,9 @@
方式1:基于浏览器 (访问时后跳到登录页面,登录成功后跳转到redirect_uri指定的地址) [GET] 提示: 以下测试是基于项目安装成功,初始化数据库(initial_db.ddl, oauth.ddl, initial_data.ddl)后的测试, 也可在页面上点击"client_details"菜单里进行测试
方式1:基于浏览器 (grant_type=authorization_code) 分两步完成
第一步: 获取code, 访问时后跳到登录页面,登录成功后跳转到redirect_uri指定的地址 [GET]
说明:只能使用admin或unity 账号登录才能有权限访问,若使用mobile账号登录将返回Access is denied 说明:只能使用admin或unity 账号登录才能有权限访问,若使用mobile账号登录将返回Access is denied
http://localhost:8080/spring-oauth-server/oauth/authorize?client_id=unity-client&redirect_uri=http%3a%2f%2flocalhost%3a8080%2fspring-oauth-server%2funity%2fdashboard&response_type=code&scope=read&state=123456 http://localhost:8080/spring-oauth-server/oauth/authorize?client_id=unity-client&redirect_uri=http%3a%2f%2flocalhost%3a8080%2fspring-oauth-server%2funity%2fdashboard&response_type=code&scope=read&state=123456
@ -8,15 +12,16 @@ http://localhost:8080/spring-oauth-server/oauth/authorize?client_id=mobile-clien
响应的URL如: 响应的URL如:
http://localhost:8080/spring-oauth-server/unity/dashboard.htm?code=zLl170 http://localhost:8080/spring-oauth-server/unity/dashboard.htm?code=zLl170
通过code换取access_token [POST] 第二步: 通过code换取access_token [POST]
http://localhost:8080/spring-oauth-server/oauth/token?client_id=unity-client&client_secret=unity&grant_type=authorization_code&code=zLl170&redirect_uri=http%3a%2f%2flocalhost%3a8080%2fspring-oauth-server%2funity%2fdashboard http://localhost:8080/spring-oauth-server/oauth/token?client_id=unity-client&client_secret=unity&grant_type=authorization_code&code=zLl170&redirect_uri=http%3a%2f%2flocalhost%3a8080%2fspring-oauth-server%2funity%2fdashboard
方式2:基于客户端 (注意参数中的username,password,对应用户的账号,密码) [POST]
方式2:基于客户端(如IOS,Android) (grant_type=password) ,需要账号与密码, 一步完成
(注意参数中的username,password,对应用户的账号,密码) [POST]
http://localhost:8080/spring-oauth-server/oauth/token?client_id=mobile-client&client_secret=mobile&grant_type=password&scope=read,write&username=mobile&password=mobile http://localhost:8080/spring-oauth-server/oauth/token?client_id=mobile-client&client_secret=mobile&grant_type=password&scope=read,write&username=mobile&password=mobile
说明:由于unity-client不支持password,所以若用unity-client通过password方式去授权,将返回invalid_grant 说明:由于unity-client不支持password,所以若用unity-client通过password方式去授权,将返回invalid_grant

Loading…
Cancel
Save