ImmatureSignatureError as soon as I pass the cognito access token to JWT decode() method for verifying signature against JWKS.

0

Hi, I am getting ImmatureSignatureError as soon as I pass the cognito access token to JWT decode() method for verifying signature against JWKS. However, If i delay a bit like less than a sec, the issue is not existing. What's the best practice to tackle this issue?

1 Answer
0

Hello ,

Warm greetings from aws!

From your case notes I understand that you are getting the error => ImmatureSignatureError. This error is happening whenever you are trying to decode the jwt tokens immediately using jwt decode(). However you are not getting the error when introducing a delay of less than a second .

Please feel free to correct me if I did not understand your issue.

======= Solution

I would like to highlight that the error => ImmatureSignatureError. is not a cognito specific error and it is related to a specific jwt decoder you are using in your usecase.

The error is documented here => [1] https://pyjwt.readthedocs.io/en/latest/api.html#jwt.exceptions.ImmatureSignatureError "Raised when a token’s nbf claim represents a time in the future"[1]

However on best effort I have identified the issue and it seems to be related to the local time and server time has some clock skew.

================================ References and solution implementation

I am sharing some articles on best efforts basis to resolve this issue: =>https://github.com/jpadilla/pyjwt/pull/794 =>https://pyjwt.readthedocs.io/en/latest/api.html#jwt.exceptions.ImmatureSignatureError => https://github.com/nextstrain/cli/issues/307

NOTE : Third-party link shared above contains third party information and are not endorsed by AWS hence we cannot guarantee the authenticity of the content. It is shared for reference purpose only on a best-effort basis in order to assist you.

hemant
answered 6 months ago
profile picture
EXPERT
reviewed 24 days ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions