配置 Postman 以测试从 Azure AD B2C 获取新的访问令牌

Configure Postman to Test Get New Access Token from Azure AD B2C

我正在按照 Microsoft 提供的说明设置 Postman 以测试 Azure AD B2C 安全 Wep API:

https://docs.microsoft.com/en-us/aspnet/core/security/authentication/azure-ad-b2c-webapi?view=aspnetcore-3.0

https://docs.microsoft.com/en-us/azure/active-directory-b2c/tutorial-register-applications?tabs=applications#register-a-web-application

使用 Postman 获取令牌并测试 API 部分下,我进入第 4 步,文档指出:

Postman opens a new window containing the Azure AD B2C tenant's sign-in dialog. Sign in with an existing account (if one was created testing the policies) or select Sign up now to create a new account.

The Forgot your password? link is used to reset a forgotten password.

这不会发生。

我正在使用隐式授权类型,我的身份验证 URL 显示如下:

https://<myDomain>.b2clogin.com/<myDomain>.onmicrosoft.com/oauth2/v2.0/authorize?p=B2C_1_SIGNUP_SIGNIN&client_id=d4d84f32-1e57-4daf-b010-399bb2614e0d&nonce=defaultNonce&redirect_uri=https%3A%2F%2Fjwt.ms&scope=openid&response_type=id_token&prompt=login

范围设置为以下值:

https://<myDomain>.onmicrosoft.com/postman/user_impersonation openid offline_access

当我按下 Postman Request Token 按钮时,SignIn / SignUp 用户流程(策略)被中断并显示以下错误对话框说明:

Sorry, but we're having trouble signing you in. We track these errors automatically, but if the problem persists feel free to contact us. In the meantime, please try again.

Correlation ID: c1b01e2d-84ce-446e-a9c2-f3a8617eb9f2
Timestamp: 2019-11-21 20:03:31Z
AADB2C90018: The client id 'd4d84f32-1e57-4daf-b010-399bb2614e0d,d4d84f32-1e57-4daf-b010-399bb2614e0d' specified in the request is not registered in tenant '<myDomain>.onmicrosoft.com'.

考虑到这个client ID is not registered表面上的错误,问题可能与Azure AD B2C中的应用程序(客户端)注册不当有关。

但是,我能够从 Azure AD B2C 中成功运行 登录/注册 用户流程;并使用该政策成功注册新用户。

需要说明的是,我的 ASP.Net Core Web API 目前还没有 运行。我只是想配置 Postman 以从 Azure AD B2C 请求新的访问令牌。

我已经测试了你提供的文件,对我来说没问题。

根据您的错误消息,您似乎在客户端 ID 中输入了两次客户端 ID。

AADB2C90018: The client id 'd4d84f32-1e57-4daf-b010-399bb2614e0d,d4d84f32-1e57-4daf-b010-399bb2614e0d' specified in the request is not registered in tenant '.onmicrosoft.com'.

请查收。