1

我在 aws lambda(环境 nodejs6.10)中遇到问题,试图将用户注册为自定义提供程序。我在后端调用 getOpenIdTokenForDeveloperIdentity ,使用以下参数:

const params = {
  IdentityPoolId: config.IDENTITY_POOL_ID,
  Logins: {
    [config.DEVELOPER_PROVIDER_NAME]: id
  }
}

负责调用的代码很简单:

const cognitoidentity = new AWS.CognitoIdentity({apiVersion: '2014-06-30'})
return cognitoidentity.getOpenIdTokenForDeveloperIdentity(params).promise()
.then(...)

不幸的是,来自 Cognito 的答案是这个错误:

{
  "message": "Not Found",
  "code": "UnknownError",
  "statusCode": 404,
  "time": "2017-09-13T16:50:12.832Z",
  "requestId": "4RQE2T66K7LOT3RBGOMN0JO82NVV4KQNSO5AEMVJF66Q9ASUAAJG",
  "retryable": false,
  "retryDelay": 58.96973108302359
}

2 年前我用几乎相同的代码完成了这项工作,并且仍在工作,但在这个项目中它不是。我为未经身份验证的用户制作了一个小型 Web 客户端,它与 Cognito 配合得很好,所以我假设 cognito 设置正确。cognito 和 lambda,us-east-1 的区域相同。角色和政策似乎是正确的,lambda 有权使用 Cognito Identity 执行所有操作。我现在不知道该怎么办,只是想如果不能解决这个问题就离开 cognito。请帮忙。

信息的其他相关部分:我使用的是无服务器框架,但 cognito 身份池是手动创建的(角色相同)。

Lambda 允许的权限:

[
  "cognito-identity:DeleteIdentities",
  "cognito-identity:DescribeIdentity",
  "cognito-identity:GetOpenIdTokenForDeveloperIdentity",
  "cognito-identity:ListIdentities",
  "cognito-identity:LookupDeveloperIdentity",
  "cognito-identity:MergeDeveloperIdentities",
  "cognito-identity:UnlinkDeveloperIdentity"
]

代码初始化

const AWS = require('aws-sdk')

AWS.config.update({
  region: config.REGION
})
AWS.config.setPromisesDependency(require('bluebird'))
4

1 回答 1

2

已解决:问题是由于我的 dynamodb 数据层加载的 AWS 配置中的错误端点

于 2017-09-14T22:56:45.807 回答