Skip to content

API gateway not accepting the token received from @aws-sdk/client-cognito-identity-provider using AdminInitiateAuthCommand #4866

Answered by RanVaknin
hirenchauhan2 asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @hirenchauhan2,

The error you are seeing is returned from your lambda authorizer. After the auth process, you are given a JWT token. You can decode that token manually and examine the contents. Is it different than the one returned by using the other library?

From what I can tell in your first implementation you are using the IdToken, and in the second example you are providing the access token (which normally you would use), is this your intention?

// old:
const authToken = authentication.getIdToken().getJwtToken(); // ID token

// new:
const authToken = authentication.AuthenticationResult.AccessToken;  // access token

// new with ID Token:
const idToken = authentication.Authenticati…

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@hirenchauhan2
Comment options

Answer selected by hirenchauhan2
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
response-requested Waiting on additional info and feedback. Will move to \"closing-soon\" in 7 days.
2 participants