问题
I'm using this code to authenticate and to get access token using azure adb2c. And i'm using 'react-azure-adb2c' msal library. i tried using (https://login.microsoftonline.com/tfp/) instance value as well.
import b2cauth from 'react-azure-adb2c';
b2cauth.initialize({
instance: 'https://MyPortaldemo.b2clogin.com/tfp/',
tenant: '4f7d3971-9a3b-4a58-9342-ab0ffc4b842a',
signInPolicy: 'B2C_1_signupsigninmydemoapp',
applicationId: 'ad8597bc-484b-495e-b968-ce91b60c4947',
cacheLocation: 'sessionStorage',
scopes: ['https://MyPortaldemo.onmicrosoft.com/apireact/user_impersonation','openid'],
//redirectUri: 'http://localhost:3000',
postLogoutRedirectUri: window.location.origin,
});
b2cauth.run(() => {
ReactDOM.render(<App />, document.getElementById('root'));
serviceWorker.unregister();
});
and i'm getting this error
回答1:
Summarize your comment as answer to help others who have the same problem.
When you set up an identity provider for sign-up and sign-in in your Azure Active Directory B2C (Azure AD B2C) application, you need to specify a redirect URL. You should no longer reference login.microsoftonline.com in your applications and APIs. Instead, use
b2clogin.comfor all new applications, and migrate existing applications fromlogin.microsoftonline.comtob2clogin.com.
The deprecation of login.microsoftonline.com goes into effect for all Azure AD B2C tenants on 04 December 2020, providing existing tenants one year to migrate to b2clogin.com. New tenants created after 04 December 2019 will not accept requests from login.microsoftonline.com. All functionality remains the same on the b2clogin.com endpoint.
For more details, you could refer to this article about migrating applications and apis to b2clogin.com.
来源:https://stackoverflow.com/questions/61453943/getting-unsupportedauthorityvalidation-error-in-react-while-using-react-azure