【问题标题】:React SPA Azure ADB2C password reset user flowReact SPA Azure ADB2C 密码重置用户流程
【发布时间】:2021-11-11 11:28:19
【问题描述】:

我正在关注带有 msal 和 AADB2C 的 React 示例。

如果用户在我的signIn 流程中单击“忘记了我的密码”,我想运行reset password flow。从here看到我需要处理这个案子:

if (event.eventType === EventType.LOGIN_FAILURE) {
  if (event.error && event.error.errorMessage.indexOf("AADB2C90118") > -1) {
     if (event.interactionType === InteractionType.Redirect) {
       instance.loginRedirect(b2cPolicies.authorities.forgotPassword);
     } else if (event.interactionType === InteractionType.Popup) {
       instance.loginPopup(b2cPolicies.authorities.forgotPassword)
               .catch(e => {
                  return;
                });
     }
  }
}

forgotPassword 权限是一个URL,例如https://tenantName.b2clogin.com/tenantName.onmicrosoft.com/B2C_1_PasswordReset。尽管我正在关注这些示例和文档,但我遇到了这个问题,似乎没有任何提及或解决方案:

未处理的拒绝 (TypeError):无法在字符串“https://tenantName.b2clogin.com/tenantName.onmicrosoft.com/B2C_1_PasswordReset”上创建属性“authenticationScheme”

【问题讨论】:

  • 你是怎么解决的?

标签: reactjs azure-active-directory msal.js msal-react


【解决方案1】:

您在控制台中收到错误:未处理的拒绝(TypeError):无法在字符串上创建属性“authenticationScheme”

您收到此错误是因为您在代码的某处使用“authenticationScheme”,但在阶段“authenticationScheme”对象为空或未定义。

更新您的代码:

if (authenticationScheme) {
do something here.
}

如果 authenticationScheme 为 null 或未定义,则更新后将不会在 null 或未定义对象上执行代码。

【讨论】:

  • 嗨@Rutha,我没有在代码库中的任何地方使用 authenticationScheme,我所做的只是使用密码重置策略调用 loginRedirect,我仍然遇到这个问题。你能帮帮我吗?
  • 你在内部服务器 AD 上试过这个吗?
猜你喜欢
  • 2023-02-01
  • 1970-01-01
  • 2020-06-01
  • 1970-01-01
  • 2019-08-15
  • 2020-09-04
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多