[英]OAuth 2 Access Token
I am getting following exception while trying to read from a URL https://accounts.accesscontrol.windows.net/tokens/OAuth/2我在尝试从 URL https://accounts.accesscontrol.windows.net/tokens/OAuth/2读取时遇到以下异常
IOException : Server returned HTTP response code: 400 for URL: https://accounts.accesscontrol.windows.net/tokens/OAuth/2 IOException:服务器返回 HTTP 响应代码:URL 为 400: https : //accounts.accesscontrol.windows.net/tokens/OAuth/2
Can you please help ?你能帮忙吗?
-Abhinav -阿比纳夫
If you got following message如果您收到以下消息
The request contains 1 tokens separated by \'=\' instead of a single key value pair请求包含 1 个由 \'=\' 分隔的令牌,而不是单个键值对
problem may be in your URL - you should pass all params in POST body , but URL itself must be clean - this is done for security reasons问题可能出在您的 URL 中 - 您应该在 POST body 中传递所有参数,但 URL 本身必须是干净的 - 这样做是出于安全原因
如果您在 POST 请求的参数字符串中包含尾随与号 ('&'),您可能会看到此错误消息。
I had the same error, check that your POST is of type x-www-form-urlencoded
, with parameters only in the POST body.我有同样的错误,请检查您的 POST 类型是否为x-www-form-urlencoded
,参数仅在 POST 正文中。 form-data
didn't work for me as well. form-data
对我也不起作用。 You can try with curl:您可以尝试使用 curl:
curl -X POST https://YOURURL/token -d grant_type=authorization_code -d redirect_uri=https://example-app.com/redirect -d client_id=YOURID -d client_secret=YOURSECRET -d code_verifier=YOURVERIFIER -d code=YOURCODE
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.