Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JWTGenerateCommand::handle() does not exist

Tags:

jwt

laravel-5

I am using Laravel 5.4 and JWT Auth Library for user authentication in API development. After installation while i am running php artisan jwt:generate then it throws me error of

Method Tymon\JWTAuth\Commands\JWTGenerateCommand::handle() does not exist 

Any idea what i am missing ?

like image 843
Chintan7027 Avatar asked Sep 08 '17 20:09

Chintan7027


2 Answers

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

like image 131
Harsukh Makwana Avatar answered Sep 22 '22 08:09

Harsukh Makwana


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

public function handle() { $this->fire(); }
like image 29
Toni Avatar answered Sep 26 '22 08:09

Toni