AWS Cognito,无法将用户池中的用户与身份池集成

AWS Cognito, Failure to Integrate a User in a User Pool with an Identity Pool

我想使用 Cognito 用户池作为身份提供者。 我验证我的用户。 然后,我尝试按照以下步骤将此用户与用户池中的用户集成:

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.<region>.amazonaws.com/<YOUR_USER_POOL_ID>': result.getIdToken().getJwtToken()
   }
  });
 }
 });
}

http://docs.aws.amazon.com/cognito/latest/developerguide/amazon-cognito-integrating-user-pools-with-identity-pools.html

但是,AWS 的响应是 "Invalid login token. Not a valid OpenId Connect identity token."

请求负载是这样的:

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

我已经用字符串替换了敏感部分。 我已将身份池配置为使用用户池作为身份验证提供程序。

是否还有我遗漏或未记录的其他步骤?

请求负载的结构不正确。登录应该是一个地图,而不是一个具有键值对的对象。