2017-04-03 27 views
3

我遇到了爲AWS Cognito設置憑據的問題。AWS Cognito無法在CognitoIdentityCredentials上設置憑據

我有以下從AWS amazon-cognito-identity-js代碼用例4.

AWS.config.credentials = new AWS.CognitoIdentityCredentials({ 
      IdentityPoolId : '...', // your identity pool id here 
      Logins : { 
       // Change the key below according to the specific region your user pool is in. 
       'cognito-idp.<region>.amazonaws.com/<YOUR_USER_POOL_ID>' : result.getIdToken().getJwtToken() 
      } 
     }); 

我已經檢查了我的CognitoIdentityCredentials方法發送正確IdentityPoolIdLogins,但我得到了一個未定義的accessKeyId和sessionToken作爲回報。

下面是我得到的。 CognitoIdentityCredentials {expired: true, expireTime: null, accessKeyId: undefined, sessionToken: undefined, params: Object…}

任何想法如何解決這個問題?

回答

1

之後你是否調用'AWS.config.credentials.get()'以確保憑證提供程序請求憑證?

相關問題