如何在Azure AD B2C的react-aad-msal中使“忘记密码”起作用? [英] How do I make 'forgot password' working in react-aad-msal with Azure AD B2C?

查看:103
本文介绍了如何在Azure AD B2C的react-aad-msal中使“忘记密码”起作用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将



似乎我需要指定名称我的忘记密码政策,但我不知道将密码放在哪里。



基于Tony的回答,此代码已添加到我的应用的渲染器中:

 如果(window.location.href.indexOf( error_description = AADB2C90118)> = 0)
{
return< ; AzureAD
provider = {
新的MsalAuthProviderFactory({
授权:'https://login.microsoftonline.com/tfp/x5aaas.onmicrosoft.com/B2C_1_PwdReset',
clientID : a1568977-3095-4bf6-a6d6-c10c87658488,
范围:['https://x5aaas.onmicrosoft.com/ui/use'],
类型:LoginType.Redirect,
postLogoutRedirectUri:window.origin,
})
}
unauthenticatedFunction = {this.unauthenticatedFunc tion}
userInfoCallback = {this.userJustLoggedIn}
authenticatedFunction = {this.authenticatedFunction}
/> ;;
}

我看到单击忘记密码?后,情况才成立,然后返回。但是,密码重置窗口没有显示,我被重定向回我的应用程序URL。



有任何建议吗?

解决方案

我所做的就是在App.js中创建一条路由:

 < Route 
path = / forgot
component = {()=> {
window.location.href = forgotPasswordUrl;
返回null;
}}
/>

然后,在构造函数中

 如果(window.location.hash.indexOf('AADB2C90118')> == 0){
history.push(' /忘记');
}

这可行。


I am using react-aad-msal with Azure AD B2C. I have sign-in and sign-out working. However, when I click 'Forgot your password?', the auth window disappears and nothing happens.

It seems I need to specify name of my 'forgot password' policy, but I do not know where to put it.

Based on Tony's answer added this code to my App's render:

if (window.location.href.indexOf("error_description=AADB2C90118") >= 0)
    {
      return <AzureAD
      provider={
        new MsalAuthProviderFactory({
          authority: 'https://login.microsoftonline.com/tfp/x5aaas.onmicrosoft.com/B2C_1_PwdReset', 
          clientID: 'a1568977-3095-4bf6-a6d6-c10c87658488',
          scopes: ['https://x5aaas.onmicrosoft.com/ui/use'],
          type: LoginType.Redirect,
          postLogoutRedirectUri: window.origin,
        })
      }
      unauthenticatedFunction={this.unauthenticatedFunction}
      userInfoCallback={this.userJustLoggedIn}
      authenticatedFunction={this.authenticatedFunction}
    />;
    }

I see that after I click "Forgot password?", the condition is true, and return happens. However, the window for password reset does not show up and I get redirected back to my app URL.

Any suggestions?

解决方案

What I did was create a Route in my App.js:

          <Route
            path="/forgot"
            component={() => {
              window.location.href = forgotPasswordUrl;
              return null;
            }}
          />

Then, in the constructor

if (window.location.hash.indexOf('AADB2C90118') >= 0) {
  history.push('/forgot');
}

And that works.

这篇关于如何在Azure AD B2C的react-aad-msal中使“忘记密码”起作用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆