-
Notifications
You must be signed in to change notification settings - Fork 113
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Token Expired Issue with Auth::guard('api')->login($user) in Production #267
Labels
bug
Something isn't working
Comments
I have configured JWT without expiration by commenting out in jwt.php:
config jwt.php :
my
In the staging environment, the JWT no longer has an expiration. However, in production, it still has an expiration. |
Try:
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Subject of the issue
I'm experiencing an issue in production where tokens generated using
Auth::guard('api')->login($user)
are expiring prematurely with the errorPHPOpenSourceSaver\JWTAuth\Exceptions\TokenExpiredException: Token has expired
. This issue only occurs in the production environment, while local and staging environments work as expected. Here is some relevant configuration and setup information:Your environment:
Configuration: Here’s my current JWT configuration in config/jwt.php:
'ttl' => env('JWT_TTL', 60 * 24 * 30), // 30 days TTL
In .env, I have also set:
JWT_TTL=43200
Steps to reproduce
Call
Auth::guard('api')->login($user)
andAuth::guard('api')->tokenById($user->user_id)
Expected behaviour
Token created
Actual behaviour
Throws exception
PHPOpenSourceSaver\JWTAuth\Exceptions\TokenExpiredException: Token has expired
The text was updated successfully, but these errors were encountered: