jwt-auth
jwt-auth copied to clipboard
fix: overwrite custom claims from token
Description
There is a problem. When a user is authorized, his data is written to getJWTCustomClaims. But if the user changes them during the session, the data in the token remains old when the token is updated. The subsequent update takes the data from the token and overwrites the new user data. This causes the token to contain irrelevant data. If you exit the session and login again, the data is taken up to date.
public function getJWTCustomClaims()
{
return [
'locale' => $this->locale ?? config('app.fallback_locale'),
];
}
lgtm, however could you please add a test with this scenario as well?
Waiting for testing scenario to merge 👍