'AWS CognitoIdentityCredentials has credentials, but fails to get values
I'd like to get a secret key and access key ID as a cognito license.
cognitoUser.authenticateUser(authenticationDetails, {
onSuccess: function (result) {
const idToken = result.getIdToken().getJwtToken();
AWS.config.credentials =
new AWS.CognitoIdentityCredentials({
IdentityPoolId:
'ap-northeast-2:7fc9xxxx-xxxx-xxxx-xxxxx-xxxxx',
Logins: {
'cognito-idp.ap-northeast-2.amazonaws.com/userPoolid':
idToken,
},
})
}
On the Cognito aws Identity Pool page, it is confirmed that the identity browser has become a credential.
However, in getCredentials
, "Could not load credentials from CognitoIdentityCredentials" is generated.
AWS.config.getCredentials(function (err) {
if (err) return console.error(err.stack);
else console.log('Access key:', AWS.config.credentials.accessKeyId);
})
The AWS.config.credentials
console log shows the following:
Problem not found.
Is it right to get the secret key issued through Cognito Identity Credentials?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|