gpt4 book ai didi

node.js - Aws Cognito 联合身份在 getOpenIdTokenForDeveloperIdentity() 上回答 UnknownError Not Found

转载 作者:太空宇宙 更新时间:2023-11-03 23:24:20 25 4
gpt4 key购买 nike

我在 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
}

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

最佳答案

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

关于node.js - Aws Cognito 联合身份在 getOpenIdTokenForDeveloperIdentity() 上回答 UnknownError Not Found,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46213660/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com