首次登录时不提示更改密码

问题描述 投票:0回答:1

我正在使用Graph API创建用户,这就是我创建用户的方式

 let payload = {
    "displayName": value.data.displayName,
    "identities": [
      {
        "signInType": "userName",
        "issuer": "{tenantName}.onmicrosoft.com",
        "issuerAssignedId": value.data.memberNumber
      },
      {
        "signInType": "emailAddress",
        "issuer": "{tenantName}.onmicrosoft.com",
        "issuerAssignedId": value.data.email
      }
    ],
    "passwordProfile": {
      "forceChangePasswordNextSignIn": true,
      "password": value.password
    },
    "passwordPolicies": "DisableStrongPassword"
  }

[当我使用"forceChangePasswordNextSignIn": true中的passwordProfile创建用户时,即使在首次登录时,我总是会收到下图所示的错误,即password has expired

enter image description here

azure azure-ad-b2c azure-ad-graph-api
1个回答
0
投票

当前应该是一个限制。

您可以参考a previous similar post了解登录策略。登录策略通过向Azure AD B2C目录发送grant_type=password请求来验证用户凭据。如果forceChangePasswordNextLogin属性设置为true,则此请求将返回“ user_password_expired”错误。登录策略通过显示“无效的电子邮件地址/用户或密码”错误来处理此错误。

因此,如Chris Padgett所建议的,您可以创建一个自定义属性(例如ForceResetPasswordNextLogin),在创建本地帐户时将其设置为true,然后根据登录策略将其作为应用程序声明发出到您的B2C应用程序。

登录后,如果将其设置为true,则您的B2C应用程序可以启动密码重置策略。重置密码后,您的B2C应用程序可以将其设置为false

Custom policy也是一个选择。

© www.soinside.com 2019 - 2024. All rights reserved.