我根据此文档(https://developers.vendhq.com/documentation/oauth.html#oauth)使用OAuth 2.0进行授权并出现此错误.我正在使用提琴手
Content-Type: application/x-www-form-urlencoded
URL : https://{domain_prefix}.vendhq.com/api/1.0/token
Run Code Online (Sandbox Code Playgroud)
请求
方法:POST
内容类型:application/x-www-form-urlencoded
URL:https:// {domain_prefix} .vendhq.com/api/1.0/token
参数:
code = {code}
client_id = {app_id}
client_secret = {app_secret}
grant_type = authorization_code
redirect_uri = {redirect_uri}
根据RFC6749的4.1.3节,POST请求的编码主体应该是这样的code={code}&client_id={app_id}&client_secret={app_secret}&grant_type=authorization_code&redirect_uri={redirect_uri}.
例:
grant_type = authorization_code&代码= SplxlOBeZQQYbYS6WxSbIA&REDIRECT_URI = HTTPS%3A%2F%2Fclient%2Eexample%2Ecom%2Fcb&CLIENT_ID = CLIENT_ID_1234&client_secret = CLIENT_SECRET
不要忘记编码重定向Uri:http://foo.bar/=>http%3A%2F%2Ffoo.bar%2F
关于身份验证错误,可能是因为授权服务器在发布请求中不支持客户端密钥(或者您的客户端不允许使用它).然后尝试使用基本身份验证方案添加Authorization标头.此标头的值是Basic {ENCODED_AUTHENTICATION}用{ENCODED_AUTHENTICATION} =base64(client_id + ':' + client_secret)
使用此标头,必须删除post请求中的client_id和client_secret.您的请求参数变为code={code}&grant_type=authorization_code&redirect_uri={redirect_uri}.
| 归档时间: |
|
| 查看次数: |
14011 次 |
| 最近记录: |