Tymon JWTAuth class not found
Solution 1
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
Solution 2
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.
Solution 3
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"
Hamid
Cooking mobile stuff with JavaScript, TypeScript, react-native and Swift
Updated on August 12, 2022Comments
-
Hamid over 1 year
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?
-
Hamid about 8 yearsI added this before. I think my problem is related to composer auto loader and maybe it's not working. How can I find composer auto load files work correctly?
-
Hamid about 8 yearsThank you @Digitlimit but still I have problem :\
-
Emeka Mbah about 8 yearsYou need to verify Tymon\AUth service provider is in vendor/jwt-auth/src/providers
-
Hamid about 8 yearsYES! Thank you @Digitlimit my problem was in my folders structure.
-
pixelworlds almost 7 yearsI get the following error (using Laravel 5.4) after adding the provider.
Class 'Tymon\JWTAuth\Providers\JWT\NamshiAdapter' not found
-
Toby Speight over 6 yearsThank you for this code snippet, which might provide some limited, immediate help. A proper explanation would greatly improve its long-term value by showing why this is a good solution to the problem, and in what way it differs from the current accepted answer. Please edit your answer to add some explanation, including the assumptions you've made.
-
Vrian7 over 4 yearsWorking on laravel 5.8