AWS Cognito, Failure to Integrate a User in a User Pool with an Identity Pool
<p>I want to use the Cognito User Pool as the identity provider.
I authenticate my user.
I then try to Integrate this user with the User in the User Pool, by following these steps:</p>

<pre><code>var cognitoUser = userPool.getCurrentUser();

if (cognitoUser != null) {
    cognitoUser.getSession(function(err, result) {
if (result) {
    console.log('You are now logged in.');

    // Add the User's Id Token to the Cognito credentials login map.
    AWS.config.credentials = new AWS.CognitoIdentityCredentials({
    IdentityPoolId: 'YOUR_IDENTITY_POOL_ID',
    Logins: {
   'cognito-idp.&lt;region&gt;.amazonaws.com/&lt;YOUR_USER_POOL_ID&gt;': result.getIdToken().getJwtToken()
   }
  });
 }
 });
}
</code></pre>

<p><a href="http://docs.aws.amazon.com/cognito/latest/developerguide/amazon-cognito-integrating-user-pools-with-identity-pools.html" rel="nofollow">http://docs.aws.amazon.com/cognito/latest/developerguide/amazon-cognito-integrating-user-pools-with-identity-pools.html</a></p>

<p>However, the response from AWS is "Invalid login token. Not a valid OpenId Connect identity token."</p>

<p>The request payload was like this:</p>

<blockquote>
  <p>{ "IdentityPoolId": "eu-west-1:idPoolValue", "Logins": {
  "loginString": "cognito-idp.eu-west-1.amazonaws.com/regionValue : id
  token value" } }</p>
</blockquote>

<p>I've replaced the sensitive parts with a string.
I've configured the identity pool to use the User Pool as an authentication provider.  </p>

<p>Are there any further steps that I've missed or that aren't documented?   </p>