【Azure Developer】CURL 发送Oauth2 Token请求获取到 404 Not Found 问题

简介: 【Azure Developer】CURL 发送Oauth2 Token请求获取到 404 Not Found 问题

问题描述

当使用 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为:

相关文章
|
18天前
|
API
【Azure Developer】记录一段验证AAD JWT Token时需要设置代理获取openid-configuration内容
【Azure Developer】记录一段验证AAD JWT Token时需要设置代理获取openid-configuration内容
|
19天前
|
存储 安全 API
【Azure API 管理】在APIM中使用客户端证书验证API的请求,但是一直提示错误"No client certificate received."
【Azure API 管理】在APIM中使用客户端证书验证API的请求,但是一直提示错误"No client certificate received."
|
19天前
|
JavaScript 前端开发 Linux
【Azure 应用服务】NodeJS Express + MSAL 实现API应用Token认证(AAD OAuth2 idToken)的认证实验 -- passport.authenticate()
【Azure 应用服务】NodeJS Express + MSAL 实现API应用Token认证(AAD OAuth2 idToken)的认证实验 -- passport.authenticate()
|
19天前
|
API 数据安全/隐私保护 网络架构
【Azure API 管理】解决调用REST API操作APIM(API Management)需要认证问题(Authentication failed, The 'Authorization' header is missing)
【Azure API 管理】解决调用REST API操作APIM(API Management)需要认证问题(Authentication failed, The 'Authorization' header is missing)
|
19天前
|
JSON Java API
【Azure Developer】如何验证 Azure AD的JWT Token (JSON Web 令牌)?
【Azure Developer】如何验证 Azure AD的JWT Token (JSON Web 令牌)?
|
19天前
|
Java API 数据安全/隐私保护
【Azure Developer】使用 adal4j(Azure Active Directory authentication library for Java)如何来获取Token呢 (通过用户名和密码方式获取Access Token)
【Azure Developer】使用 adal4j(Azure Active Directory authentication library for Java)如何来获取Token呢 (通过用户名和密码方式获取Access Token)
|
19天前
|
Java API 开发工具
【Azure Developer】使用 Microsoft Authentication Libraries (MSAL) 如何来获取Token呢 (通过用户名和密码方式获取Access Token)
【Azure Developer】使用 Microsoft Authentication Libraries (MSAL) 如何来获取Token呢 (通过用户名和密码方式获取Access Token)
|
21天前
|
API 数据安全/隐私保护 网络架构
【Azure Developer】使用Postman获取Azure AD中注册应用程序的授权Token,及为Azure REST API设置Authorization
【Azure Developer】使用Postman获取Azure AD中注册应用程序的授权Token,及为Azure REST API设置Authorization
|
3月前
|
Kubernetes 容器 Perl
k8s部署seata 报错 没有提供足够的身份验证信息 [ http-nio-7091-exec-2] [ty.JwtAuthenticationEntryPoint] [ commence] [] : Responding with unauthorized error. Message - Full authentication is required to access this resource
Kubernetes pod 在16:12时出现两次错误,错误信息显示需要完整认证才能访问资源。尽管有此错误,但页面可正常访问。附有yaml配置文件的图片。
270 2
|
11月前
【异常解决】postman请求提示Full authentication is required to access this resource
【异常解决】postman请求提示Full authentication is required to access this resource
211 0