I'm using amazon-cognito-identity-js to authenticate my user pool users.And after authenticating it's passing access token, id token and refresh token.And also the user id is there(user's id in user pool).Is there any way to get user attributes like(nick name,birthday,address) with these tokens or the with the user id in aws-cognito
Asked
Active
Viewed 4,349 times
1 Answers
8
Oh it's straight forward with aws sdk CognitoIdentityServiceProvider class.Can use the same access token that we are getting from the user authentication
var params = {
AccessToken: "string"
};
var cognitoidentityserviceprovider = new AWS.CognitoIdentityServiceProvider();
cognitoidentityserviceprovider.getUser(params, function(err, data) {
if (err) {
console.log(err, err.stack);
} // an error occurred
else{
console.log(data);
} // successful response
})

Ayeshmantha Perera
- 869
- 9
- 34