Errors:
Auth guard driver [api] is not defined.
Lumen 5.4 - Auth guard driver [api] is not defined.
InvalidArgumentException: Auth guard [api] is not defined.
Solution:
Basically, the API guard driver is missing from the auth file. First, we need to set up the API guard.
Open file config/auth.php
We can see default web guard is already defined.
'api' => [
'driver' => 'token',
'provider' => 'users',
],
If you are using any package, then update the API index accordingly.
For passport, package add
'api' => [
'driver' => 'passport',
'provider' => 'users',
],
For jwt package add
'api' => [
'driver' => 'jwt',
'provider' => 'users',
],
After adding or updating the API guard driver, please run composer update using the following command.
composer update.
That's all we need to do. If you have any questions or suggestions please do share them in the comment section
No comments:
Post a Comment