1

I have integrated aws-sdk in my node project and trying to get the user details using adminGetUser(). Below is my code.

AWS.config.update({
                region:'us-east-2',
                credentials: new AWS.CognitoIdentityCredentials({
                    IdentityPoolId: 'identity_pool_id'
                })
            }); 
            let cognitoidentityserviceprovider = new AWS.CognitoIdentityServiceProvider();
            let userPool = 'user_pool_id';
            var params = {
                UserPoolId: userPool,
                Username: req.body.customer.email
            };
            cognitoidentityserviceprovider.adminGetUser(params, function (err, data) {
                if (err) {
                    console.log(err);
                } else {
                    console.log(data);
                }
            });

But getting the below error

CredentialsError: Missing credentials in config
     at Request.extractError (/user/node_modules/aws-sdk/lib/protocol/json.js:48:27)
     at Request.callListeners (/user/node_modules/aws-sdk/lib/sequential_executor.js:105:20)
     at Request.emit (/user/node_modules/aws-sdk/lib/sequential_executor.js:77:10)
    at Request.emit (/user/node_modules/aws-sdk/lib/request.js:683:14)
     at Request.transition (/user/node_modules/aws-sdk/lib/request.js:22:10)
     at AcceptorStateMachine.runTo (/user/node_modules/aws-sdk/lib/state_machine.js:14:12)
     at /user/node_modules/aws-sdk/lib/state_machine.js:26:10
     at Request.<anonymous> (/user/node_modules/aws-sdk/lib/request.js:38:9)
     at Request.<anonymous> (/user/node_modules/aws-sdk/lib/request.js:685:12)
   originalError: 
    { message: 'Could not load credentials from CognitoIdentityCredentials',
      code: 'CredentialsError',
      time: 2018-10-10T14:39:04.356Z,
      requestId: '3c381b82-cc9a-11e8-b5fd-6728c4333ce8',
      statusCode: 400,
      retryable: false,
      retryDelay: 95.84437296226204,
      originalError: 
       { message: 'Invalid identity pool configuration. Check assigned IAM roles for this pool.',
         code: 'InvalidIdentityPoolConfigurationException',
         time: 2018-10-10T14:39:04.355Z,
        requestId: '3c381b82-cc9a-11e8-b5fd-6728c4333ce8',
         statusCode: 400,
         retryable: false,
         retryDelay: 95.84437296226204 } }

Any help in this will be appreciate

Arunkumar K
  • 43
  • 2
  • 5
  • 1
    Have a look at [this](https://stackoverflow.com/questions/30425942/aws-cognito-invalid-identity-pool-configuration) SO question. – Jeroen Heier Oct 10 '18 at 15:22

0 Answers0