将应用程序从react-azure-adb2c移植到react-aad [英] Porting app from react-azure-adb2c to react-aad
问题描述
我正在使用Azure AD B2C。我需要一些react库来对我的react.js应用程序中的用户进行身份验证。
我从react-azure-adb2c开始。诸如登录和注销之类的主要方案对我来说效果很好。但是,图书馆所有者停止了对图书馆的支持,因此我需要寻找其他图书馆。
使用
I am using Azure AD B2C. I need some react library to authenticate users in my react.js app.
I started with react-azure-adb2c. Primary scenarios like login and logout worked well for me. However, the library owner stopped supporting the library, so I need to find other one.
Experimenting with react-aad. I used the example and got nice page that suggests popup or redirect login. However, both do not work. Most likely my configuration contains errors. If I do not provide authority, I get microsoft auth page, not for my tenant. If I provide 'https://x5aaas.b2clogin.com/x5aaas.onmicrosoft.com', as directed by this post, i see error in console "endpoints_resolution_error:Endpoints cannot be resolved".
It seems there are some configuration mistakes:
provider={
new MsalAuthProviderFactory({
authority: 'https://x5aaas.b2clogin.com/x5aaas.onmicrosoft.com',
clientID: 'a1568977-3095-4bf6-a6d6-c10c87658488',
scopes: ['https://x5aaas.onmicrosoft.com/ui/use'],
type: LoginType.Redirect,
persistLoginPastSession: true,
postLogoutRedirectUri: window.origin.location,
})
}
I use basic react app with type script, created with
npx create-react-app <appName> --typescript
What can be wrong here?
The value of the authority is not correct. You should use https://login.microsoftonline.com/tfp/<your-tenant-name>.onmicrosoft.com/<your-sign-in-sign-up-policy>
The value of your-sign-in-sign-up-policy
is the name of the policy.
这篇关于将应用程序从react-azure-adb2c移植到react-aad的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!