Open nargalzius opened 11 months ago
So I have a method that will allow generation of custom JWTs for different sites (with different JWT secrets)
Here's the method, pretty simple and it used to work fine before I upgraded to Laravel 9
protected function createUserToken($user, $claims = null, $secret = null) { // GENERATE KEY WITH DIFFERENT JWT_SECRET if($secret) { JWTAuth::getJWTProvider()->setSecret($secret); } if($claims) { $factory = JWTFactory::customClaims($claims); $payload = $factory->make(); return JWTAuth::encode($payload); } return JWTAuth::fromUser($user); }
The token generated should be encoded with the custom key, and should be able to validate on jwt.io when you provide said custom key.
The tokens being generated are still using the site's key instead of the custom provided key through the setSecret() method
setSecret()
yes is same for me. Still an issues
JWTAuth::getJWTProvider()->setSecret() doesn't seem to be working
So I have a method that will allow generation of custom JWTs for different sites (with different JWT secrets)
Here's the method, pretty simple and it used to work fine before I upgraded to Laravel 9
Your environment
Steps to reproduce
Expected behaviour
The token generated should be encoded with the custom key, and should be able to validate on jwt.io when you provide said custom key.
Actual behaviour
The tokens being generated are still using the site's key instead of the custom provided key through the
setSecret()
method