Porting app from react-azure-adb2c to react-aad

一个人想着一个人 提交于 2019-12-24 14:12:01

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/55645155/porting-app-from-react-azure-adb2c-to-react-aad

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!