0

我在aws lambda(環境nodejs6.10)中遇到問題,試圖將用戶註冊爲自定義提供程序。 我打電話getOpenIdTokenForDeveloperIdentity在我的後端,這個PARAMS:Aws Cognito聯盟身份答案UnknownError Not Found on 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設置正確。該地區是相同的認知和lambda,我們東1。角色和政策似乎是正確的,lambda有權使用Cognito Identity做所有事情。我不知道現在該做什麼,只是在想如果不能解決這個問題時留下認知。請幫忙。

其他相關部分信息: 我正在使用無服務器框架,但認證身份池是手動創建的(角色相同)。

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')) 

回答

0

:這個問題是由於一個錯誤的終點在AWS的配置,我的dynamodb數據層加載

相關問題