Ad
How To Get Extra Attributes Of A User In User Pool In AWS Cognito
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
Ad
Answer
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
})
Ad
source: stackoverflow.com
Related Questions
- → Maximum call stack exceeded when instantiating class inside of a module
- → Browserify api: how to pass advanced option to script
- → Node.js Passing object from server.js to external modules?
- → gulp-rename makes copies, but does not replace
- → requiring RX.js in node.js
- → Remove an ObjectId from an array of objectId
- → Can not connect to Redis
- → React: How to publish page on server using React-starter-kit
- → Express - better pattern for passing data between middleware functions
- → Can't get plotly + node.js to stream data coming through POST requests
- → IsGenerator implementation
- → Async/Await not waiting
- → (Socket.io on nodejs) Updating div with mysql data stops without showing error
Ad