[英]Angular 8 with Azure B2C Authentication (using MSAL.js)
I'm trying to create a basic authentication app (SPA) using Angular 8 with Azure B2C login.我正在尝试使用 Angular 8 和 Azure B2C 登录创建一个基本身份验证应用程序 (SPA)。 I'm using this sample here .我在这里使用这个示例。
I already configured the "app registration" for the SPA, but I'm not sure whats is the "Web API" in the sample.我已经为 SPA 配置了“应用程序注册”,但我不确定示例中的“Web API”是什么。 When I run the project I can login but after redirect to Angular I got the following error:当我运行项目时,我可以登录,但在重定向到 Angular 后,我收到以下错误:
The application with ID '<MY_CLIENT_ID>' cannot get an ID token either because the openid scope was not provided in the request or the application is not authorized for it.
Can someone help me, please?有人能帮助我吗?
Thank you谢谢
While registering your application in the Azure AD B2C you need to configure the consent for openid and offline_access permission.在 Azure AD B2C 中注册您的应用程序时,您需要为 openid 和 offline_access 权限配置同意。
If you missed this configuration you can enable this in App -> API Permissions- > Microsoft Graph-> Delegated Permissions -> openid如果您错过了此配置,您可以在 App -> API Permissions-> Microsoft Graph-> Delegated Permissions -> openid 中启用它
This permission helps you to sign in to app with your work or school account and allow the app to see basic user profile information此权限可帮助您使用工作或学校帐户登录应用,并允许应用查看基本用户个人资料信息
this sample has 2 methods of setup, either use their demo tenant, where you don't set anything, just run.此示例有 2 种设置方法,或者使用他们的演示租户,您无需设置任何内容,只需运行即可。 or if you are setting your own app registration in the spa, which it appears that you are, then you also need to set up the web api from a different sample, as per the readme, https://github.com/Azure-Samples/active-directory-b2c-javascript-nodejs-webapi so you need to set this up, then in the API permissions, MY APIs will show in the SPA app registration.或者,如果您在 spa 中设置自己的应用程序注册,看起来您就是这样,那么您还需要根据自述文件 Z5E056C500A1C4B6A7110.com/Azure/Z5E056C500A1C4B6A7110.com/Azure Samples/active-directory-b2c-javascript-nodejs-webapi所以你需要设置它,然后在 API 权限中,MY APIs 将显示在 SPA 应用程序注册中。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.