Amazon-cognito-identity-js: Invalid login token. Issuer doesn't match providerName

Created on 20 May 2016  路  2Comments  路  Source: amazon-archives/amazon-cognito-identity-js

I'm very new to AWS and I've been struggling with authentication. I used the code from this git for authenticating a user and it worked, but when I try to initialize dynamodb, I receive this error:
"NotAuthorizedException: Missing credentials in config" with the message "Invalid login token. Issuer doesn't match providerName".

This is the code I used to update my credentials after it has been authenticated.

AWS.config.credentials = new AWS.CognitoIdentityCredentials({ IdentityPoolId: 'us-east-1:...', Logins: { 'cognito-idp.us-east-1.amazonaws.com/us-east-1:...': result.getIdToken().getJwtToken() } }); //CONNECT TO DB var db = new AWS.DynamoDB({region: 'us-east-1'});

Any help would be appreciated. Thanks!

Most helpful comment

Hi,

Your implementation looks ok, but I have a concern on the key you have used in the _Logins_ map. The second part of the key, which start with _us-east-1_, should be your user pool id. Pool id's are of the format _us-east-1_xxxxxxxxx_, where _xxxxxxxxx_ are a set of alpha-numeric characters that are unique to your user pool.
Can you please check if the key you have used is of the form _cognito-idp.us-east-1.amazonaws.com/us-east-1_xxxxxxxxx_ ?

Thanks,
Mahesh

All 2 comments

Hi,

Your implementation looks ok, but I have a concern on the key you have used in the _Logins_ map. The second part of the key, which start with _us-east-1_, should be your user pool id. Pool id's are of the format _us-east-1_xxxxxxxxx_, where _xxxxxxxxx_ are a set of alpha-numeric characters that are unique to your user pool.
Can you please check if the key you have used is of the form _cognito-idp.us-east-1.amazonaws.com/us-east-1_xxxxxxxxx_ ?

Thanks,
Mahesh

Wow, thank you so much. Such a simple fix. I was using my Identity Pool ID instead of the user pool ID for that portion. Thanks again!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

johnf picture johnf  路  3Comments

kpitzen picture kpitzen  路  3Comments

BerndWessels picture BerndWessels  路  5Comments

sarah-pixvana picture sarah-pixvana  路  4Comments

ZwaarContrast picture ZwaarContrast  路  4Comments