[英]Angular Azure Active Directory B2C Authentication - CORS issue
I am implementing Azure Active Directory B2C authentication in Angular.我正在 Angular 中实现 Azure Active Directory B2C 身份验证。 I am using msal interceptor to connect Azure AD B2C.
我正在使用 msal 拦截器连接 Azure AD B2C。 The authentication request fails with error
身份验证请求失败并显示错误
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.
CORS 策略阻止了在 ' https://login.microsoftonline.com/ ...' 从源 ' http://localhost/ ...' 访问 XMLHttpRequest:没有 'Access-Control-Allow-Origin' 标头存在于请求的资源上。
I configured everything according to this post: https://medium.com/@sambowenhughes/configuring-your-angular-6-application-to-use-microsoft-b2c-authentication-99a9ff1403b3我根据这篇文章配置了一切: https : //medium.com/@sambowenhughes/configuring-your-angular-6-application-to-use-microsoft-b2c-authentication-99a9ff1403b3
That article is about two years old and this.clientApplication.authority = "https://login.microsoftonline.com/tfp/"
doesn't look right.那篇文章大约有两年历史了,
this.clientApplication.authority = "https://login.microsoftonline.com/tfp/"
看起来不对。 It should be something like https://${b2cTenantName}.b2clogin.com/${b2cTenantName}.onmicrosoft.com/B2C_1_Sign_In
.它应该类似于
https://${b2cTenantName}.b2clogin.com/${b2cTenantName}.onmicrosoft.com/B2C_1_Sign_In
。
Can you try to configure the angular sample app from https://github.com/Azure-Samples/active-directory-b2c-javascript-angular-spa and use that as a starting point?您可以尝试从https://github.com/Azure-Samples/active-directory-b2c-javascript-angular-spa配置 angular 示例应用程序并将其用作起点吗?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.