tymondesigns / jwt-auth

🔐 JSON Web Token Authentication for Laravel & Lumen
https://jwt-auth.com
MIT License
11.24k stars 1.55k forks source link

Keep getting "Token has expired" exception when generating token? #1516

Open websanova opened 6 years ago

websanova commented 6 years ago

It keeps throng a Tymon\JWTAuth\Exceptions\TokenExpiredException when calling $token = JWTAuth::attempt($req->only('email', 'password'));.

I'm not even sending a token, just trying to generate one.

Bug: yes framework: laravel version: 5.4.30 package version: 1.0.0-rc.2, 1.0.0-beta.3 php version: 7.1.3

Was working before but I updated to the latest rc version and then it just keeps giving me the error.

$token = JWTAuth::attempt($req->only('email', 'password'));

I tried down grading back but the error remained, no idea what's going on....

websanova commented 6 years ago

I found out that it has something to do with the JWT_LEEWAY value.

'leeway' => env('JWT_LEEWAY', 0),

The default is 0, I had to set this to 1 second, bit strange...

richardudovich commented 4 years ago

I noticed that this does not seem to have any effect on IssuedAt claim ... can anyone suggest why?

richardudovich commented 4 years ago

Hi, apologies for having multiple discussions, but the reason for this is outlined here https://github.com/tymondesigns/jwt-auth/issues/1851#issuecomment-656230087

stale[bot] commented 3 years ago

Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward?

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.