简体   繁体   English

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

[英]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.

相关问题 Angular Azure B2C SSO问题 - Angular Azure B2C SSO issue Angular 4 / Angular 2针对Azure B2C Active Directory验证SPA - Angular 4/Angular 2 validate SPA against Azure B2C Active Directory Angular 8 与 Azure B2C 身份验证(使用 MSAL.js) - Angular 8 with Azure B2C Authentication (using MSAL.js) 在Angular 4.5 Service中未定义的Msal用于Azure B2C身份验证 - Msal undefined in Angular 4.5 Service for Azure B2C authentication 用于 Angular 8 应用程序的 Azure B2C,带有 angular-auth-oidc-client - b2clogin 端点 POST CORS 错误 - Azure B2C for Angular 8 app with angular-auth-oidc-client - b2clogin endpoint POST CORS error Azure AD B2C 登录问题 - Login Issue to Azure AD B2C 对于使用 Angular SPA 获取的 Active Directory B2C JWT 令牌,acr 声明为 null - acr claim is null for the Active Directory B2C JWT token acquired using Angular SPA 如何使用 angular 在前端使用 Azure b2c 身份验证 - how to use Azure b2c Authentication on front-side with angular 使用 Angular 8 和 Azure Active Directory 进行身份验证 - Authentication using Angular 8 with Azure Active Directory 通过ADAL进行Angular 2 Azure Active Directory身份验证 - Angular 2 Azure Active Directory authentication via ADAL
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM