I have tried below lines to update the userEmail in aws cognito. For update email, the updateAttributes is needed.
import {Auth} from 'aws-amplify';
let user = await Auth.currentAuthenticatedUser();
user.session = user.signInUserSession;
let userAttributes = await Auth.userAttributes(user);
let new = { Name: 'email', Value: emailAddress }
Auth.updateUserAttributes(user, new).then((res) => {
console.log("success", res);
}).catch(e => {
console.log("EEE", e);
});
But when I tried, I got this error:
{"code": "InvalidParameterException", "message": "user.Value: Attribute does not exist in the schema.
user.Name: Attribute does not exist in the schema.
", "name": "InvalidParameterException"}