问题描述
我在我的应用程序中使用 aws cognito 用户池,用户可以使用他们在 aws cognito 中验证的电子邮件登录应用程序。 用户可以更改登录电子邮件,用户必须验证新电子邮件。 但是现在用户在我的应用程序中无法更改登录电子邮件,我不知道如何解决。 我们需要找到一种解决方案来更新 AWS Cognito 上的电子邮件并修复它。 如何在 aws cognito 用户池中更改用户的电子邮件?
解决方法
在 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;