JWTGenerateCommand::handle() does not exist

This error generally display when you install jwt package in laravel 5.5 version. then after you set service providers and run following command.

php artisan jwt:generate

then you seen this error message in terminal.

how to resolve it? simple follow this step

Step - 1 Re-install package

composer require tymon/jwt-auth:dev-develop --prefer-source

or the following is a new release package use laravel 6.X

composer require tymon/jwt-auth:1.0.*

in this developement version this errors fixed.

Step - 2 Set Service Provider

'providers' => [
    ....
    Tymon\JWTAuth\Providers\JWTAuthServiceProvider::class to 
    Tymon\JWTAuth\Providers\LaravelServiceProvider::class
],

Step - 3 Generate key

php artisan jwt:secret

i found this solution from here https://laravelcode.com/post/method-tymonjwtauthcommandsjwtgeneratecommandhandle-does-not-exist


Go to JWTGenerateCommand.php file located in vendor/tymon/src/Commands and paste this method

public function handle() { $this->fire(); }

It's never a great idea to change anything in the vendor folder but the there's two ways to deal with this ...

  1. Generate a random string yourself and just change the value in the JWT config file.

  2. Go to Tymon\JWTAuth\Commands\JWTGenerateCommand and change the fire method to handle.

Tags:

Jwt

Laravel 5