Locally jwt worked fine but on heroku server its not working
| Q | A
| ----------------- | ---
| Bug? | yes
| New Feature? | no
| Framework | Laravel
| Framework version | 5.7.9
| Package version | 1.0.0-rc.3
| PHP version | 7.2.1
try jwt on heroku server
Token should be generated.
{ "message": "Type error: Argument 2 passed to Lcobucci\JWT\Signer\Hmac::createHash() must be an instance of Lcobucci\JWT\Signer\Key, null given, called in .../app/vendor/lcobucci/jwt/src/Signer/BaseSigner.php on line 34", "status_code": 500 }
are you already run command php artisan jwt:secret to generate jwt secret key in your heroku?
@muhtarudinsiregar yes , already did
I'm getting this error. All working fine on local dev but not live. Any suggestions please?
I'm getting this error. All working fine on local dev but not live. Any suggestions please?
Sorry @StevieDC I did not find any solution either. if you found any solution please let me know
@shantudas @StevieDC I met with a similar problem too. I changed the 'JWT Provider' to 'jwt' => Tymon\JWTAuth\Providers\JWT\Lcobucci::class in the jwt.php file and cleared the config cache.
Controller constructor:
public function __construct(JWTAuth $jwtAuth)
{
$this->jwtAuth = $jwtAuth;
}
Did this work? I am stuck.
nope @dagenius007
@shantudas Do you have a jwt.php in your config?
As mine was working locally I decided to bypass Git and Ftp everything up to the server (except .env). It then worked on the live server!
You might need to clear your cache after running php artisan jwt:secret. I clear laravel cache using php artisan clear-compiled && php artisan optimize
stop php artisan serve, and start again
I was having a problem on Fortrabbit. The fix for me was to upload my .env file. It was in the gitignore so it was not committed. At the bottom of the .env file is the jwt secret.
This error happens when JWT_SECRET is not defined
For me works only run:
php artisan jwt:secret
and after:
php artisan clear-compiled && php artisan optimize
Works Fine!!
Thanks!!
For me works only run:
php artisan jwt:secretand after:
php artisan clear-compiled && php artisan optimizeWorks Fine!!
Thanks!!
THIS WORKS!!!
composer update
php artisan vendor:publish
php artisan jwt:secret
Verify if JWT_SECRET is defined in your ENV file or even in config/jwt.php
php artisan config:clear
php artisan cache:clear
php artisan clear-compiled && php artisan optimize
composer dumpautoload
This worked fine for me.
=)
php artisan jwt:secret. I clear laravel cache using php artisan clear-compiled && php artisan optimize
This work! Thank you!!!
are you already run command
php artisan jwt:secretto generate jwt secret key in your heroku?
Thank you :) working good
are you already run command
php artisan jwt:secretto generate jwt secret key in your heroku?
This helps.. thanks :)
Simply add the below JWT_SECRET from your local .env file at the bottom of your remote .env file
Something like;
JWT_SECRET=roCZauuldMpw5i4039393939393372y98bEWumqd9ls7Uk8DEpr0gIZ6WIWB
Hope this helps :)
For me, using Heroku,
heroku run php artisan jwt:secret
was not working, but
heroku config:set JWT_SECRET=<your generated key>
worked.
And then clear cache.
@shantudas @StevieDC I met with a similar problem too. I changed the 'JWT Provider' to
'jwt' => Tymon\JWTAuth\Providers\JWT\Lcobucci::classin the jwt.php file and cleared the config cache.Controller constructor:
public function __construct(JWTAuth $jwtAuth) { $this->jwtAuth = $jwtAuth; }
Wooow greate jobe man this one works with me
Most helpful comment
are you already run command
php artisan jwt:secretto generate jwt secret key in your heroku?