Hi,
I managed to make a successful authentication and I am trying to access my Lambda function. The function is allowed to get by specific role I gave to my authenticated users.
When I tried just to access it I got a message that my role for unauthenticated users cannot invoke that function, so I figured I'm just not using the token I just got for the user.
When I'm trying to apply the user's credentials in the config, I get the following message:
"Invalid login token. Missing a required claim: aud".
This is what I do:
AWS.config.credentials = new AWS.CognitoIdentityCredentials({
IdentityPoolId: 'us-east-1:XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX',
Logins: {
'cognito-idp.us-east-1.amazonaws.com/us-east-1_XXXXXXXXX': result.getAccessToken().getJwtToken(),
}
});
AWS.config.credentials.get(function(err){
// Here I get the error message.
});
Any help would be appreciated,
Thank you!
Guy.
You should use getIdToken, not getAccessToken. See #7
Oh right! Thanks, lusentis. It works.
lusentis; Thanks a million. I was googling for the last 4-7 hours. Thanks alot.
Please fix the documentation
Most helpful comment
You should use getIdToken, not getAccessToken. See #7