title: Cognito getId: NotAuthorizedException: Invalid login token. Not a valid OpenId Connect identity token
body: <p>I am new to Cognito (JWT tokens &amp; whole auth thing in general) so pardon me for asking stupid questions. I am trying to use Cognito user pools with identity pools. I logged in a user using the default URL (<a href="https://testapi123.auth.us-east-2.amazoncognito.com/login?response_type=token&amp;client_id=" rel="nofollow noreferrer">https://testapi123.auth.us-east-2.amazoncognito.com/login?response_type=token&amp;client_id=</a>&lt;>&amp;scope=openid&amp;redirect_uri=<a href="https://aws.amazon.com" rel="nofollow noreferrer">https://aws.amazon.com</a>) and got a token. I am unable to figure out how to get the identity id from this token for use in getId() API. This I want to later use to get credentials from the federated identity pool (not sure if i have that part right either).</p>
  
  <p>For reference, i have my code - </p>
  
  <pre><code>var AWS = require('aws-sdk');
  var cognitoidentity = new AWS.CognitoIdentity({apiVersion: '2014-06-30'});
  
  exports.handler = (event, context, callback) =&gt; {
  // TODO implement
  var params = {
      IdentityPoolId: 'us-east-2:&lt;xxxxxx&gt;', /* required */
      AccountId: 'xxxxxxx',
      Logins: {
          'cognito-idp.us-east-2.amazonaws.com/us-east-2_xxxxx': '&lt;**identityID???**&gt;',
          }
      };
  
  cognitoidentity.getId(params, function(err, data) {
      if (err) console.log('Error3 : ' + err, err.stack); // an error occurred
      else {
          console.log('retval:' + JSON.stringify(data));           // successful response
          var idenId = data.idenId;
  
          var params = {
              IdentityId: idenId,
              CustomRoleArn: 'arn:aws:iam::xxxxxxxxx:role/cc_admin',
              Logins: {
                  'CognitoIdentity': 'cognito-idp.us-east-2.amazonaws.com/us-east-2_xxxxxxx'
              }
          };
  
          cognitoidentity.getCredentialsForIdentity(params, function(err, data) {
              if (err) console.log(err, err.stack); // an error occurred
              else     console.log(data);           // successful response
          });
  
      }
  });
  callback(null, 'Hello from Lambda 1');
  };
  </code></pre>
  
  <p>The error - "2018-06-06T18:59:58.614Z   ce0fc216-69bb-11e8-bbfc-4fff0d953dd4    Error3 : NotAuthorizedException: Invalid login token. Token signature invalid. NotAuthorizedException: Invalid login token. Token signature invalid."</p>
  
  <p>I have tried parsing the JWT token received (with jwt.io). It shows me some details but none of them seem to be identity id to be used in the request. I have also tried using the entire token as identity id.</p>
  
  <p>Really need help. Thanks.</p>