React 应用程序中的 Azure AD B2C 生成 400 错误请求错误

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

我正在尝试在 https://github.com/Azure-Samples/ms-identity-javascript-react-tutorial 运行示例。在每种情况下,当我单击在 localhost:3000 上运行的登录按钮时,我都会收到以下错误

请求网址:https://login.microsoftonline.com/common/discovery/instance?api-version=1.1&authorization_endpoint=https://prasysytem.b2clogin.com/prasystem.onmicrosoft.com/b2c_1_susi/oauth2/v2。 0/授权 请求方式:GET 状态码:400 错误请求 远程地址:40.126.29.7:443 推荐人政策:严格起源时交叉来源

我创建了一个 Azure AD B2C 租户并注册了该应用程序。 然后我将 authconfig.js 修改为:

export const b2cPolicies = {
names: {
signUpSignIn: 'B2C_1_susi',
forgotPassword: 'B2C_1_pwdr',
editProfile: 'B2C_1_pe',
        },
        authorities: {
            signUpSignIn: {
                authority: 'https://prasysytem.b2clogin.com/prasystem.onmicrosoft.com/B2C_1_susi',
            },
            forgotPassword: {
                authority: 'https://prasystem.b2clogin.com/prasystem.onmicrosoft.com/2C_1_pwdr',
            },
            editProfile: {
                authority: 'https://prasystem.b2clogin.com/prasystem.onmicrosoft.com/2C_1_pe',
            },
        },
        authorityDomain: 'prasystem.b2clogin.com',
    };

    export const msalConfig = {
        auth: {
            clientId: '363d136c-3024-4c1a-b938-50c9a1c27e7e', // This is the ONLY mandatory field     that you need to supply.
            authority: b2cPolicies.authorities.signUpSignIn.authority, // Choose SUSI as your default authority.
            knownAuthorities: [b2cPolicies.authorityDomain, 'prasystem.b2clogin.com'], // Mark your B2C tenant's domain as trusted.
            redirectUri: '/', // You must register this URI on Azure Portal/App Registration. Defaults to window.location.origin
            postLogoutRedirectUri: '/', // Indicates the page to navigate after logout.
            navigateToLoginRequestUrl: false, // If "true", will navigate back to the original request location before processing the auth code response.
        },

该应用程序将运行,但是当我单击“登录”时,出现上述错误。 我对所有内容进行了两次和三次检查,创建了新租户,但结果始终相同。

有什么建议吗?

azure-active-directory azure-ad-b2c msal adal
© www.soinside.com 2019 - 2024. All rights reserved.