Reputation: 2088
I want to use laravel for building api.
I installed JWTAuth from installation guide on wiki page. When I want to use vendor:publish
, I get this error:
After 3days searching on Google, I can not find a solution that working for me. How can I fix this?
Upvotes: 2
Views: 14152
Reputation: 141
add "tymon/jwt-auth": "^0.5.12"
to composer.json and command
composer update
on app/config.php add this to providers
Tymon\JWTAuth\Providers\JWTAuthServiceProvider::class,
and on app/config.php add this on aliases
'JWTAuth' => Tymon\JWTAuth\Facades\JWTAuth::class,
'JWTFactory' => Tymon\JWTAuth\Facades\JWTFactory::class,
tested on laravel 5.5
and tymon/jwt-auth": "^0.5.12"
Upvotes: 3
Reputation: 303
For latest version. Please use following code in providers array in config file
For laravel
Tymon\JWTAuth\Providers\LaravelServiceProvider::class
For Lumen : open app/Providers/AppServiceProvider.php and add the following to the register() method.
$this->app->register(\Tymon\JWTAuth\Providers\LumenServiceProvider::class);
Hope this will help someone.
Upvotes: 4
Reputation: 17520
Simply means you have not added JWTAuthServiceProvider
to list of Laravel Service providers.
Go to config/app.php
and add JWTAuthServiceProvider
to providers list
Like so:
'providers' => [
...
Tymon\JWTAuth\Providers\JWTAuthServiceProvider::class,
...
]
Secondly since these error occurs only in console run:
composer update --no-scripts
composer update
Upvotes: 3