简体   繁体   English

404 未找到 Azure AD B2C 的 oauth2/v2.0/token 端点

[英]404 Not Found for oauth2/v2.0/token endpoint of Azure AD B2C

I'm having a hard time receiving an access_token and refresh_token via the OAuth 2.0 API of Azure AD B2C.我很难通过 Azure AD B2C 的 OAuth 2.0 API 接收access_tokenrefresh_token

I'm following the official guide describing the OAuth 2.0 authorization code flow.我正在遵循描述 OAuth 2.0 授权代码流程的官方指南

Receiving an authorization_token via the interactive login website provided by Microsoft works fine (URL: https://login.microsoftonline.com/[MY_TENANT]/oauth2/v2.0/authorize?client_id=[CLIENT_ID]&response_type=code&response_mode=query&redirect_uri=urn%3Aietf%3Awg%3Aoauth%3A2.0%3Aoob&scope=[CLIENT_ID]%20offline_access&p=[MY_SIGNUP_SIGNIN_POLICY] ).通过 Microsoft 提供的交互式登录网站接收授权令牌工作正常(网址: https://login.microsoftonline.com/[MY_TENANT]/oauth2/v2.0/authorize?client_id=[CLIENT_ID]&response_type=code&response_mode=query&redirect_uri=urn%3Aietf%3Awg%3Aoauth%3A2.0%3Aoob&scope=[CLIENT_ID]%20offline_access&p=[MY_SIGNUP_SIGNIN_POLICY] : https://login.microsoftonline.com/[MY_TENANT]/oauth2/v2.0/authorize?client_id=[CLIENT_ID]&response_type=code&response_mode=query&redirect_uri=urn%3Aietf%3Awg%3Aoauth%3A2.0%3Aoob&scope=[CLIENT_ID]%20offline_access&p=[MY_SIGNUP_SIGNIN_POLICY] )。

However, when trying to get an access_token via a simple POST request as stated in the documentation, I'm getting a 404 Not Found with the following POST request:但是,当尝试通过文档中所述的简单 POST 请求获取access_token 时,我收到以下 POST 请求的 404 Not Found:

URL: https://login.microsoftonline.com/[MY_TENANT]/oauth2/v2.0/token?p=B2C_1_sign_in
Header: Content-Type application/x-www-form-urlencoded
Payload: grant_type=authorization_code&client_id=[CLIENT_ID]&scope=[CLIENT_ID]%20offline_access&code=[AUTHORIZATION_CODE]&redirect_uri=urn:ietf:wg:oauth:2.0:oob

Is the documentation wrong at that point?那个时候文档有错吗?

Note: I'm not able to use any existing .NET or Java libraries providing this login procedure due to framework reasons.注意:由于框架原因,我无法使用任何现有的 .NET 或 Java 库提供此登录过程。 A C++ library would do.一个 C++ 库就可以了。

I so very much want them to implement the usual complete headless OAuth2 protocol in a standard-conformant way ...我非常希望他们以符合标准的方式实现通常的完整无头 OAuth2 协议......

The problem was my misunderstanding of the documentation.问题是我对文档的误解。

The policy (query parameter p ) must be the same in all cases.策略(查询参数p )在所有情况下都必须相同。 Thus, the URL for the POST request has to be:因此,POST 请求的 URL 必须是:

https://login.microsoftonline.com/[MY_TENANT]/oauth2/v2.0/token?p=MY_SIGNUP_SIGNIN_POLICY

Where MY_SIGNUP_SIGNIN_POLICY is exactly the same as in the login URL.其中MY_SIGNUP_SIGNIN_POLICY与登录 URL 中的完全相同。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Azure AD B2C 在客户端凭据的 /oauth2/v2.0/token 端点中缺少随机数 - Azure AD B2C missing nonce in /oauth2/v2.0/token end point for client credentials Azure B2C Userflow v2.0(注册和登录) - 无法找到 Userinfo 端点 - Azure B2C Userflow v2.0(SignUp and SignIn) - unable to find Userinfo endpoint 在 Azure AD b2b 中使用我自己的域自定义域 https://login.microsoftonline.com/{tenant_id}/oauth2/v2.0/token - Customize domain with my own domain in Azure AD b2b https://login.microsoftonline.com/{tenant_id}/oauth2/v2.0/token Azure AD B2C -> OAuth2 -> Azure Function App Token Exchange - Azure AD B2C -> OAuth2 -> Azure Function App Token Exchange Azure B2C访问令牌NULL春季OAuth 2.0 - Azure B2C Access Token NULL Spring OAuth 2.0 Azure AD B2C中的吊销终结点 - Revocation endpoint in Azure AD B2C Azure AD v2.0使用令牌进行MobileApp身份验证 - Azure AD v2.0 using the token for MobileApp authentication 如何在 Azure AD B2C oauth2 登录中获取用户的对象 ID - How to get user's Object ID in Azure AD B2C oauth2 login 使用OAuth2 Provider的Azure AD B2C社交登录 - Azure AD B2C social sign-in with OAuth2 Provider Spring OAuth2客户端:oauth2 / v2.0 / token的POST请求上的I / O错误 - Spring OAuth2 Client: I/O error on POST request for oauth2/v2.0/token
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM