vendredi 9 octobre 2020

Laravel Error: InvalidArgumentException Auth driver [jwt] for guard [api] is not defined

I’m getting this error thrown back at me when I try to run php artisan commands in my Laravel Vue Spa Project

InvalidArgumentException

Auth driver [jwt] for guard [api] is not defined.

 at C:\laragon\www\laravel-vue-spa\vendor\laravel\framework\src\Illuminate\Auth\AuthManager.php:97
    93|         if (method_exists($this, $driverMethod)) {
    94|             return $this->{$driverMethod}($name, $config);
    95|         }
    96|
 >  97|         throw new InvalidArgumentException(
    98|             "Auth driver [{$config['driver']}] for guard [{$name}] is not defined."
    99|         );
   100|     }
   101|

 1   C:\laragon\www\laravel-vue-spa\vendor\laravel\framework\src\Illuminate\Auth\AuthManager.php:68
    Illuminate\Auth\AuthManager::resolve("api")

 2   C:\laragon\www\laravel-vue-spa\vendor\laravel\framework\src\Illuminate\Support\Facades\Facade.php:261
    Illuminate\Auth\AuthManager::guard("api")

This is my config/auth.php

'defaults' => [
    'guard' => 'api',
    'passwords' => 'users',
 ],

 'guards' => [
    ...

    'api' => [
       'driver' => 'jwt',
       'provider' => 'users',
    ],
  ],

Please help if you can solve this error or if you have solved it already?... I have tried all the answers I could find on google but they didn’t work.

Thanks in advance.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire