【问题标题】:Can change the user's email in aws cognito user pool?可以在 aws cognito 用户池中更改用户的电子邮件吗?
【发布时间】:2021-06-07 04:42:40
【问题描述】:
我在我的应用程序中使用 aws cognito 用户池,用户可以使用在 aws cognito 中验证的电子邮件登录应用程序。
用户可以更改登录电子邮件,并且用户必须验证新电子邮件。
但是用户现在无法在我的应用程序中更改登录电子邮件,我不知道如何解决。
我们需要找到一个解决方案来更新 AWS cognito 上的电子邮件并修复它。
如何在 aws cognito 用户池中更改用户的电子邮件?
【问题讨论】:
标签:
amazon-web-services
amazon-cognito
email-verification
【解决方案1】:
在 Amazon Cognito 再次发送电子邮件后,您可以使用adminUpdateUserAttributes 更新用户email 和email_verified(检查here)。
const params = {
UserPoolId: 'UserPoolID',
Username: 'username',
UserAttributes: [
{
Name: "email",
Value: "new email"
},
{
Name: "email_verified",
Value: "false"
}
],
};
const cognitoClient = new AWS.CognitoIdentityServiceProvider();
const createPromise = cognitoClient.adminUpdateUserAttributes(params).promise();
await createPromise;