我知道管理员可以使用以下命令从控制台重置用户的临时密码:
aws cognito-idp admin-create-user --region us-east-1 --user-pool-id us-east-1_youruserpoolid --username theusername --message-action RESEND
在这里,我需要一些用户触发选项,触发后他应该会收到新的临时密码邮件。这类似于自助选项,用户无需为重置临时密码而调用管理员。
我尝试使用resendConfirmationCode
来实现。
https://github.com/aws-amplify/amplify-js/blob/master/packages/amazon-cognito-identity-js/src/CognitoUser.js
使用 request:
{ClientId: "v3miuf2k********", Username: "suni*********"}
得到的响应为:
{code: "NotAuthorizedException", name: "NotAuthorizedException", message: "Can't resend confirmation code for this user"}
代码:"NotAuthorizedException"
信息:"无法为此用户重新发送确认代码"
名称:"NotAuthorizedException"