Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

clmnt's avatar
Level 1

"Auth driver [passport] for guard [api] is not defined" error with Passport v8

Hello,

I'm trying to update Laravel Passport to v8 but I got this error in my test

1) My test
InvalidArgumentException: Auth driver [passport] for guard [api] is not defined.

.../vendor/laravel/framework/src/Illuminate/Auth/AuthManager.php:97
.../vendor/laravel/framework/src/Illuminate/Auth/AuthManager.php:68
.../vendor/laravel/passport/src/Passport.php:409
...Test.php:26

On this line

Passport::actingAs($user);

This was working before, I tried to understand when it could come from but can't find.

I have this in my config/auth.php file

'guards' => [
        'web' => [
            'driver'   => 'session',
            'provider' => 'users',
        ],

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

Thanks for your help

0 likes
5 replies
clmnt's avatar
Level 1

I've followed this, but nothing specific to do on my side.

Jaytee's avatar

Ahh, this is relating to a test. I thought this was happening when updating. Few articles on that, I'll have a read of them and get back to you.

Please or to participate in this conversation.