首页 > 解决方案 > ReactJS 前端与 Azure AD B2C 错误 UnsupportedAuthorityValidation

问题描述

我对此有疑问,我将 ReactJS 前端与 Azure AD B2C 一起使用,但是当我运行 react 时显示此错误“Uncaught (in promise) UnsupportedAuthorityValidation”我仍然不明白为什么

import b2cauth from 'react-azure-adb2c';


b2cauth.initialize({
  instance: 'https://FunSuitDev.onmicrosoft.com/tfp/', 
  tenant: 'FunSuitDev.onmicrosoft.com',
  signInPolicy: 'B2C_1_ADB2C_API',
  applicationId: 'ae82c7fe-a82b-448d-905f-6a63827e92a4',
  cacheLocation: 'sessionStorage',
  scopes: ['https://FunSuitDev.onmicrosoft.com/teastAPI/user_impersonation'],
  redirectUri: 'http://localhost:3000',
  postLogoutRedirectUri: window.location.origin,
});


b2cauth.run(() => {
  ReactDOM.render(<App />, document.getElementById('root'));
  serviceWorker.unregister();
});

在此处输入图像描述

标签: reactjsazureazure-active-directory

解决方案


请检查您的库的版本,此问题将对您有所帮助。

  1. 使用{your-tenant-name}.b2clogin.com而不是login.microsoftonline.com.

  2. 如果您使用的是 MSAL.NET v2 或更早版本,请将ValidateAuthority属性设置为false,请参见此处


推荐阅读