1

I am using AWS Cognito and want to know how to use AdminUpdateUserAttributes in Golang to change the email address.

https://docs.aws.amazon.com/sdk-for-go/api/service/cognitoidentityprovider/#CognitoIdentityProvider.AdminUpdateUserAttributes

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 Can change the user's email in aws cognito user pool? has an answer for when using the username option.

0

1 Answer 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),
})

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),
            },
        },
})
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.