【Azure Developer】CURL 发送Oauth2 Token请求获取到 404 Not Found 问题
发布时间:2022-09-07 11:53:53 187
相关标签: # 信息
问题描述
当使用 Postman 向AAD 发送如下请求时候,得到了404 Not Found的错误。
"curl --location --request POST 'https://login.chinacloudapi.cn//oauth2/token' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'grant_type=client_credentials' \
--data-urlencode 'client_id=' \
--data-urlencode 'client_secret=' \
--data-urlencode 'resource=https://management.chinacloudapi.cn'"
问题分析
404 表示所请求的URL有错误, 查看以上命令使用的为 'https://login.chinacloudapi.cn//oauth2/token' ,发现在Oauth2之前,缺少了AAD的Tenant ID信息。所以,完整的Token URL应是:
https://login.chinacloudapi.cn/{Tenant ID}/oauth2/token
在AAD门户中Tenant ID 及正确的Token URL为:
当在复杂的环境中面临问题,格物之道需:浊而静之徐清,安以动之徐生。 云中,恰是如此!
文章来源: https://blog.51cto.com/u_13773780/5643408
特别声明:以上内容(图片及文字)均为互联网收集或者用户上传发布,本站仅提供信息存储服务!如有侵权或有涉及法律问题请联系我们。
举报