We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Generated token with custom claims & secret (via JWTAuth::getJWTProvider()->setSecret()) isn't encoded with the custom secret.
JWTAuth::getJWTProvider()->setSecret()
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 able to validate on jwt.io against the (custom) secret you provided.
The tokens being generated are still encoded with the site .env secret instead of the provided one.
.env
The text was updated successfully, but these errors were encountered:
Successfully merging a pull request may close this issue.
Subject of the issue
Generated token with custom claims & secret (via
JWTAuth::getJWTProvider()->setSecret()
) isn't encoded with the custom secret.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 able to validate on jwt.io against the (custom) secret you provided.
Actual behaviour
The tokens being generated are still encoded with the site
.env
secret instead of the provided one.The text was updated successfully, but these errors were encountered: