jpadilla / pyjwt

JSON Web Token implementation in Python
https://pyjwt.readthedocs.io
MIT License
5.05k stars 676 forks source link

how can i use leeway to avoid exception for "raise ImmatureSignatureError("The token is not yet valid (iat)")"? #854

Closed CCodeInspect closed 1 year ago

CCodeInspect commented 1 year ago

I just see the issues for this bug and i get this:

jwt.encode({'iat': int(time.time()) + leeway}, 'secret', algorithm='HS256')

**My question is how can i use this var named leeway? like this?

leeway=1 jwt.encode({'iat': int(time.time()) + leeway}, 'secret', algorithm='HS256')**

And it doesn't work.

CCodeInspect commented 1 year ago

if i can solve i just back to 2.5.0 ,please help.

CCodeInspect commented 1 year ago

i just want to know how can i set my leeway ==1 in function decode()?

github-actions[bot] commented 1 year ago

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days

deepbluelabel commented 1 year ago

@llaichiyu Add parameter leeway in decode. ex) jwt.decode(jwt_token, SECRET, algorithms=['HS256'], leeway= 1.0)

CCodeInspect commented 11 months ago

Thanks!