Why getting this error for Laravel JWT auth on heroku server

Viewed 1006

Getting this error when calling any api:

Argument 3 passed to Lcobucci\\JWT\\Signer\\Hmac::doVerify() must be an instance of Lcobucci\\JWT\\Signer\\Key, null given, called in /app/vendor/lcobucci/jwt/src/Signer/BaseSigner.php on line 44

I am using tymondesigns/jwt-auth with laravel for api authentication. I tried running this php artisan optimize after generating jwt:secret

My laravel application is hosted on basic heroku server with pgsql

1 Answers

It's possible that you are getting this error when you uploaded the applications before implementing the JWT and re-uploaded directly without reuploading the .env file.

If this is the case, the simplest way to solve this adding the JWT key in your .env file :

Here an example:

JWT_SECRET=jghgvfuldMpw5i4039393939393372y98bEWumqd9ls7Uk8DEpr0gIhgftrf

Or create jwt key with the command :

php artisan jwt:secret

Don't forget to clear config after changing your environment :

php artisan config:clear
php artisan config:cache
Related