AWS Cognito cannot set credentials for CognitoIdentityCredentials

I have a problem configuring credentials for AWS Cognito.

I have AWS amazon-cognito-identity-js code for a use case.

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()
            }
        });

      

I have verified that I am sending correct IdentityPoolId

and Logins

in CognitoIdentityCredentials

, but I am getting undefined in accessKeyId and sessionToken as return.

Here's what I got. CognitoIdentityCredentials {expired: true, expireTime: null, accessKeyId: undefined, sessionToken: undefined, params: Object…}

Any idea how to fix this?

+3


source to share


1 answer


After that, you call "AWS.config.credentials.get ()" to make sure the credentials provider is prompting for credentials?



+1


source







All Articles