【问题标题】:Resending phone_number attribute verification code in AWS Cognito在 AWS Cognito 中重新发送 phone_number 属性验证码
【发布时间】:2020-02-21 18:49:07
【问题描述】:

AWS SDK CognitoIdentityServiceProvider 中是否有办法为 CONFIRMED 用户重新发送 phone_number 属性更改验证码?

我已在 Cognito 中设置要验证的 phone_number 属性。 adminUpdateUserAttributes() 发送验证码。但是我没有找到重新发送验证码的方法。这是我正在处理的用例中的必要条件。

到目前为止,我已经尝试使用相同的电话号码进行adminUpdateUserAttributes()。它似乎没有重新发送验证码。有了新号码,就可以了。

我无法进行deleteUserAttributes() 和再次更新,因为池配置会根据需要设置电话号码。

不确定它是否相关;但请注意,我几乎必须使用 CognitoIdentityServiceProvider 管理 API,因为在用户池中也禁用了注册。

总而言之,我正在寻找一种解决方案,我可以在 Cognito 用户池中重新发送已确认用户中 phone_number 属性的验证码。

【问题讨论】:

  • 嗨!你想出解决方案了吗?我也有同样的情况:(

标签: amazon-web-services amazon-cognito


【解决方案1】:

这是 AWS Api 参考中为该流程重新发送 OTP 代码的方法: https://docs.aws.amazon.com/cognito-user-identity-pools/latest/APIReference/API_GetUserAttributeVerificationCode.html

然后在我的服务中,使用 AWS Java SDK,我称之为:

    public void resendCodeAttributeVerification(String accessToken) {
    cognitoClient.getUserAttributeVerificationCode(new GetUserAttributeVerificationCodeRequest()
            .withAttributeName(PHONE_NUMBER)
            .withAccessToken(accessToken));
     }

【讨论】:

    猜你喜欢
    • 2020-05-29
    • 1970-01-01
    • 2020-04-21
    • 2021-11-01
    • 2021-05-31
    • 1970-01-01
    • 2021-04-06
    • 2021-10-03
    • 2021-09-04
    相关资源
    最近更新 更多