英文:
Can users change email when using the email login option on AWS Cognito
问题
我正在使用AWS Cognito,并想知道如何在Golang中使用AdminUpdateUserAttributes来更改电子邮件地址。
在cognito设置过程中,在cognito用户池创建中的“您希望用户如何登录”标题下,我选择了通过电子邮件登录。
这篇帖子https://stackoverflow.com/questions/66544422/can-change-the-users-email-in-aws-cognito-user-pool 对于使用用户名选项有一个答案。
英文:
I am using AWS Cognito and want to know how to use AdminUpdateUserAttributes in Golang to change the email address.
During cognito setup, under "How do you want your users to sign in" header in cognito user pool creation I choose by email.
This post https://stackoverflow.com/questions/66544422/can-change-the-users-email-in-aws-cognito-user-pool has an answer for when using the username option.
答案1
得分: 1
output, err := cognitoClient.IDP.AdminUpdateUserAttributes(&cognitoidentityprovider.AdminUpdateUserAttributesInput{
Username: aws.String(username),
UserAttributes: []*cognitoidentityprovider.AttributeType{
{
Name: aws.String("email"),
Value: aws.String(username),
},
},
UserPoolId: aws.String(cognitoClient.UserPoolID),
})
在你的情况下,aws.String(email)
应该可以工作。
或者
output, err := cognitoClient.IDP.UpdateUserAttributes(&cognitoidentityprovider.UpdateUserAttributesInput{
AccessToken: aws.String(accessToken),
UserAttributes: []*cognitoidentityprovider.AttributeType{
{
Name: aws.String("email"),
Value: aws.String(username),
},
},
})
英文:
output, err := cognitoClient.IDP.AdminUpdateUserAttributes(&cognitoidentityprovider.AdminUpdateUserAttributesInput{
Username: aws.String(username),
UserAttributes: []*cognitoidentityprovider.AttributeType{
{
Name: aws.String("email"),
Value: aws.String(username),
},
},
UserPoolId: aws.String(cognitoClient.UserPoolID),
})
In your case aws.String(email)
should work.
or
output, err := cognitoClient.IDP.UpdateUserAttributes(&cognitoidentityprovider.UpdateUserAttributesInput{
AccessToken: aws.String(accessToken),
UserAttributes: []*cognitoidentityprovider.AttributeType{
{
Name: aws.String("email"),
Value: aws.String(username),
},
},
})
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论