Angular Azure Active Directory B2C 身份验证 - CORS 问题

标签 angular azure-ad-b2c msal azure-authentication

我正在 Angular 中实现 Azure Active Directory B2C 身份验证。我正在使用 msal 拦截器连接 Azure AD B2C。身份验证请求失败并显示错误

Access to XMLHttpRequest at 'https://login.microsoftonline.com/...' from origin 'http://localhost/...' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.



browser console screenshot

我根据这篇文章配置了一切:https://medium.com/@sambowenhughes/configuring-your-angular-6-application-to-use-microsoft-b2c-authentication-99a9ff1403b3

最佳答案

那篇文章大约两年了,this.clientApplication.authority = "https://login.microsoftonline.com/tfp/"看起来不对。它应该类似于 https://${b2cTenantName}.b2clogin.com/${b2cTenantName}.onmicrosoft.com/B2C_1_Sign_In .
您可以尝试从 https://github.com/Azure-Samples/active-directory-b2c-javascript-angular-spa 配置 Angular 示例应用程序吗?并以此为起点?

关于Angular Azure Active Directory B2C 身份验证 - CORS 问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60374965/

相关文章:

azure-active-directory - 我们如何使用msal更新idtoken?

angular - ngx-translate 与 i18n 的区别

javascript - 为什么 Javascript 对象与其单独的属性不同?

azure-active-directory - 撤销 Azure AD B2c 用户的登录 session 不适用于 native 应用程序

azure - 读取和更新 Azure AD B2C 扩展属性

authentication - Blazor Wasm with AAD B2C : SignUpSignIn userflow - reset password, 如何捕获 AADB2C90118

javascript - msal.js 包的 loginRedirect() 方法导致 'TypeError: Cannot read property ' then' of undefined'

javascript - 使用 Angular 6 插入数据时更新数据表

javascript - Angular2 组件样式/css 未在 ngAfterViewInit 中被浏览器应用

azure - Azure AD B2C 自定义策略中的 ClientUIFilterFlags(LineMarkers 或 MetaRefresh)是什么?