【发布时间】:2017-02-23 09:38:24
【问题描述】:
我有一个使用 oAuth2 的应用程序,我尝试使用此命令从终端请求访问令牌
curl -X POST -vu clientapp:123456 http://localhost:8080/oauth/token -H "Accept: application/json" -d "password=spring&username=roy&grant_type=password&scope=read%20write&client_secret=123456&client_id=clientapp"
它工作正常,我得到这样的回应
{"access_token":"29c4c218-1d9a-4d2d-abe3-197bc2969679","token_type":"bearer","refresh_token":"6b7ffda7-4652-4197-b8e9-c80635eb9143","expires_in":38630,"scope":"read write"}
但问题是当我尝试通过邮递员请求访问令牌时总是会收到此错误:
Handling error: InvalidClientException, Unauthorized grant type: client_credentials
如何通过邮递员获取访问令牌,就像我通过 curl 命令获取令牌一样?
【问题讨论】:
标签: java oauth-2.0 postman oauth2