Angular 8与Azure B2C认证(使用MSAL.js)。

问题描述 投票:0回答:2

我正在尝试使用Angular 8与Azure B2C登录创建一个基本的身份验证应用程序(SPA)。我正在使用这个示例 此处. 我已经为SPA配置了 "应用注册",但我不确定样本中的 "Web API "是什么.当我运行项目时,我可以登录,但重定向到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.

谁能帮帮我,好吗?

谢谢你的帮助

angular azure authentication msal
2个回答
2
投票

这个示例有2种设置方法,要么使用他们的演示租户,在那里你不设置任何东西,只是运行。或者,如果你是在SPA中设置自己的应用程序注册,这似乎是你,那么你还需要设置不同的示例的Web api,根据readme。https:/github.comAzure-Samplesactive-directory-b2c-javascript-nodejs-webapi。所以你需要设置这个,然后在API权限中,MY API将显示在SPA应用注册中。


2
投票

在Azure AD B2C中注册您的应用程序时,您需要配置openid和offline_access权限的同意。

enter image description here

如果你错过了这个配置,你可以在App -> API Permissions- > Microsoft Graph-> Delegated Permissions-> openid中启用这个功能

此权限可以帮助您使用您的工作或学校账户登录到应用程序,并允许应用程序查看基本的用户配置文件信息。

© www.soinside.com 2019 - 2024. All rights reserved.