tymondesigns / jwt-auth

🔐 JSON Web Token Authentication for Laravel & Lumen
https://jwt-auth.com
MIT License
11.31k stars 1.54k forks source link

Exception with php artisan jwt:generate #1481

Open mohamed-atef opened 6 years ago

mohamed-atef commented 6 years ago

Exception while generating the secret key

While executing the command php artisan jwt:generate an exception has been thrown that method handle doesn't exist in JWTGenerateCommand class Method Tymon\JWTAuth\Commands\JWTGenerateCommand::handle() does not exist.

The solution was to change the name of the method "fire" in the same class to "handle" and it worked just fine.

Your environment

Q A
Bug? yes
Framework Laravel
Framework version 5.5.34
Package version ^0.5.12
PHP version 7.0.25

Steps to reproduce

install the package and try to generate the secret.

Expected behaviour

Generating the secret code

Actual behaviour

Throw an exception

psychonetic commented 6 years ago

Hi, I can confirm this error. Having the same issue then running php artisan jwt:generate

nivanmorgan commented 6 years ago

@psychonetic @mohamed-atef with laravel 5.5 you use the command php artisan jwt:secret

and better use version 1.0.0 of this package

psychonetic commented 6 years ago

@nivanmorgan I thought I had version 1.0* installed, but when installing it like provided in the new documentation composer require tymon/jwt-auth it still installs the old version (yeah, I know it's an unfinished documetation, but writing such basic things does not take a whole day).

And yes when using version 1.0.0-rc2 php artisan jwt:secret works as expected. Thank you!

victorelu commented 6 years ago

Laravel 5.5 renamed the fire function to handle. A temporary rename in the vendor folder made this work, but perhaps a PR is in order that checks the laravel version and uses the appropriate function.