so, i upgrade my jwt
package on my Laravel v5.8, I need to upgrade because of security issue. However, upgrading jwt
is not easy, too many trial & error. Finally, i found a solution from it's github repository here then jwt
upgrade is finish.
==========
The summary of solution by adding:
(1) Upgrade jwt by composer require tymon/jwt-auth:1.0.* --prefer-source
(2) Change below line in config/app.php
, before:
'providers' => [
...
'TymonJWTAuthProvidersJWTAuthServiceProvider' ,
...
]
into
'providers' => [
...
'TymonJWTAuthProvidersLaravelServiceProvider' ,
...
]
(3) Add implements JWTSubject
into User
Model Class
(4) Add below line into User
Model Class:
public function getJWTIdentifier()
{
return $this->getKey();
}
public function getJWTCustomClaims()
{
return [];
}
(5) run php artisan vendor:publish --provider="TymonJWTAuthProvidersLaravelServiceProvider"
==========
However, it has side effect.
Now, every login sessions do not last long.
Before this fix, it sometimes need a month for a login session to expire, but now it just need a couple of hour. Moreover, no other logic/coding added except above.
Any Idea/Solution?
Thank You in Advance...
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…