提供用户重置Cognito中过期的临时密码的功能 [英] Giving user capability of resetting expired temporary password in cognito

查看:145
本文介绍了提供用户重置Cognito中过期的临时密码的功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道管理员可以使用以下命令从控制台重置用户的临时密码

I know admin can reset user's temporary password from console using the following command

aws cognito-idp admin-create-user --region us-east-1 --user-pool-id us-east-1_youruserpoolid --username theusername --message-action RESEND

但是在这里我需要用户具有触发器选项的东西,在触发器之后,他应该获得新的临时密码到他的电子邮件中。这类似于自助服务选项,用户无需致电admin即可重置其临时密码。

But here I need something where user have a trigger option, and after that trigger he should get new temp password to his email. It is something like self service option, where user don't have to call admin for resetting his temp password.

我尝试使用

https://github.com/aws-amplify/amplify-js/blob/master/packages/amazon-cognito-identity-js/src/CognitoUser.js

有请求:

{ClientId: "v3miuf2k********", Username: "suni*********"}

得到的响应为:

{code: "NotAuthorizedException", name: "NotAuthorizedException", message:  "Can't resend confirmation code for this user"}




code: NotAuthorizedException

消息:无法重新发送该用户的确认代码

名称: NotAuthorizedException

code: "NotAuthorizedException"
message: "Can't resend confirmation code for this user"
name: "NotAuthorizedException"


推荐答案

如果将来有人需要答案,只是想从AWS支持中获得官方答复。

Just wanted to put out the official response from AWS support, if someone needs the answer in the future.



  1. 我可以看到错误是由API resendConfirmationCode使用,该
    应该在没有任何凭据的情况下被调用,但是,错误
    指示消息表示为 NotAuthorizedException。这个API是否多次调用
    ?这可能会触发匿名后端
    攻击的AWS后端保护。

  1. I can see the error is caused by the API resendConfirmationCode which supposed to be called without any credentials, however, the error indication message said "NotAuthorizedException". Is this API called many times? That may trigger AWS backend side protection of anonymous attacking.

您可以尝试用相同的电子邮件创建一个新用户,并使用相同的API使用
发送确认代码吗?如果现有用户
具有相同的电子邮件地址,但未得到确认,则可以创建一个具有相同电子邮件地址的
新用户。

Can you have a try to create a new user with the same email and use the same API to send confirmation code? If there is an existing user with the same email address but not confirmed, it's fine to create a new user with the same email address.


这篇关于提供用户重置Cognito中过期的临时密码的功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆