const AWS = require('aws-sdk') AWS.config.region = 'us-east-1' // Functions const getCredentials = IdentityId => { const cognito = new AWS.CognitoIdentity({ apiVersion: '2014-06-30' }) const params = { IdentityId } return cognito.getCredentialsForIdentity(params).promise() } getCredentials('...') .then(data => { console.log(JSON.stringify(data, null, 2)) }) .catch(err => { console.log(err) })