Auth guard driver [api] is not defined. Lumen, Dingo, JWTAuth
Asked Answered
V

2

16

I am trying to develop a rest api using lumen. For authentication I am using Dingo and JWTAuth api, but I am getting the following message:

Auth guard driver [api] is not defined.

Below is a screenshot of the message from Postman, including the stacktrace.

Postman screenshot of error

Vina answered 5/3, 2017 at 9:21 Comment(1)
Please do not post images of relevant text. Include the text in an appropriately formatted manner inside your question.Auger
A
35

In your bootstrap/app.php file, make sure the following line is uncommented:

$app->register(App\Providers\AuthServiceProvider::class);

This will cause the api auth driver to be registered.

Auger answered 8/3, 2017 at 3:22 Comment(0)
C
0

Open the file bootstrap/app.php and uncomment (or add if you don't have them) the lines:

$app->register(App\Providers\AuthServiceProvider::class);

And:

$app->routeMiddleware([
    'auth' => App\Http\Middleware\Authenticate::class,
]);

And finally, run:

composer dump-autoload
Clowers answered 5/5, 2023 at 20:8 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.