【问题标题】:AWS Cognito, Failure to Integrate a User in a User Pool with an Identity PoolAWS Cognito,无法将用户池中的用户与身份池集成
【发布时间】:2017-02-10 12:18:08
【问题描述】:

我想使用 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 的响应是“无效的登录令牌。不是有效的 OpenId Connect 身份令牌。”

请求负载是这样的:

{ "IdentityPoolId": "eu-west-1:idPoolValue", "Logins": { “loginString”:“cognito-idp.eu-west-1.amazonaws.com/regionValue:id 令牌值" } }

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

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

【问题讨论】:

标签: amazon-web-services amazon-cognito


【解决方案1】:

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

【讨论】:

  • 你上传的代码是JS的,你需要java版本的。
猜你喜欢
  • 1970-01-01
  • 2016-09-26
  • 2017-02-28
  • 2021-06-08
  • 2018-11-07
  • 2017-03-25
  • 2018-08-31
  • 2018-08-23
  • 1970-01-01
相关资源
最近更新 更多