amazon-web-services - 在 AWS Cognito 中重新发送 phone_number 属性验证码
问题描述
AWS SDK CognitoIdentityServiceProvider中是否有办法为CONFIRMED用户重新发送 phone_number 属性更改验证码?
我已在Cognito中设置要验证的 phone_number 属性。adminUpdateUserAttributes()
发送验证码。但是我没有找到重新发送验证码的方法。这是我正在处理的用例中的必要条件。
到目前为止,我已经尝试过adminUpdateUserAttributes()
使用相同的电话号码。它似乎没有重新发送验证码。有了新号码,就可以了。
我无法deleteUserAttributes()
再次进行更新,因为池配置会根据需要设置电话号码。
不确定它是否相关;但请注意,我几乎必须使用CognitoIdentityServiceProvider管理 API,因为在用户池中也禁用了 Sign UP。
总而言之,我正在寻找一种解决方案,我可以在 Cognito 用户池中的已确认用户中重新发送 phone_number 属性的验证码。
解决方案
这是 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));
}
推荐阅读
- javascript - 下面代码的类型约束怎么写
- ruby - jekyll 最小错误主题抛出“未初始化常量 Faraday::Error::ClientError (NameError)”
- swift - 将 2 个图像视图约束在一起以保持它们之间相同的恒定距离
- bootstrap-4 - 按钮在桌面上看起来很棒;在移动设备上不太好(引导程序 4)
- swift - 转换为PNG时如何保持UIImage方向以生成缩略图
- reactjs - 获取 React 状态字段列表
- python - 为什么具有假定形状参数的子程序不能具有内部功能?
- flutter - 在提供程序中使用流与颤动
- minio - “mc cp --recursive”和“mc mirror --overwrite”有什么不同
- tensorflow - 大于 2GB 的张量流图