I have an Angular 11 project in which I'm using AWS Amplify (aws-amplify v3.3.26) and I'm using Cognito user pools to manage users. I've set up the hosted UI and I've not used any custom attributes. Everything is working and I've selected all the attributes for read and write permissions in the user attributes in the user pool.
I'm using the following code to get the cognitoUser object:-
Auth.currentAuthenticatedUser()
.then((currentUser) => {
console.log('The currentUser => ', currentUser);
Auth.currentUserInfo()
.then((res) => {
console.log('Here are the current user info! =>', res);
})
.catch((err) => {
console.log('Current user info failed to fetch', err);
});
})
.catch((err) => {
console.log(err);
});
return;
}
According to the AWS Amplify docs I should be able to get the attributes right within the cognitoUser object. But I'm not getting it.
This is all I get (also note that session is null, not sure what that means):-

As you can see there is no "attributes" key in the object.
I also noticed that there is a Auth.currentUserInfo() method that is available and my console log of that just results in an empty object.
And as you can see here, I have set all the required permissions for all the attributes in the user pool client definition and I don't have any custom attributes:-

Currently I am storing name and email as required attributes and all users have that. But I can't access it. I was able to see the email deeply nested within the cognitoUser object (cognitoUser.signInUserSession.idToken.payload.email) but still can't find the name attribute. I would like to get the entire attributes object listing all available attributes of the current user.
What am I missing?
