title: Cognito: User Login to Authenticate DynamoDB: Error: Missing credentials in config:
body: <p>I'm getting the below error when I try to use Cognito to log into an authenticated user. I'm trying to access DynamoDB.</p>
  <blockquote>
  <p>Error: Missing credentials in config</p>
  <p>&quot;NotAuthorizedException: Missing credentials in config</p>
  </blockquote>
  <pre><code>  AWS.config.update({region:'us-west-2'}); 
    if (cognitoUser != null) { cognitoUser.getSession(function(err, result) { 
      if (result) {
  
         console.log('You are now logged in.');
         AWS.config.credentials = new   AWS.CognitoIdentityCredentials({
                 IdentityPoolId: config.IdentityPoolId,
                 Logins: {
                     &quot;cognito-idp.us-west-2.amazonaws.com/us-west-2_XXXXXXX&quot;: result.getIdToken().getJwtToken()
                 }
             });
         }
     });
    }
  
  
  
        var  dynamoDB = new AWS.DynamoDB(AWS.config.credentials)            
  
  
         dynamoDB.listTables(function(err, data) {
             if (err) console.log(err, err.stack);
             else console.log(data.TableNames);
         });             
  </code></pre>