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

swagger's avatar

Laravel Passport with MongoDB completely broken

After year of upgrading Laravel Passport + MongoDb, it seems that now it's quite broken in my project.

I use multiple DB connection to manage different stuff. The user are store in the "general" database, and they get created correctly when using the register endpoint.

The problem lies with the token generation and establishing connections. In the register request, it fails in the file /laravel/passport/src/PersonalAccessTokenFactory.php. When it tries to establish a connection to the DB. The DB is live and running, so all is good, and the connections seems to be correct one.

I've tried multiple stuff but without success.

Laravel 11 Laravel/passport: 12 laravel/mongodb: 4

How can I "start" over and be sure to have a working auth with Passport+Mongodb?

Also running php artisan passport:client --personal I simply get

Call to a member function prepare() on null

at vendor/laravel/framework/src/Illuminate/Database/Connection.php:565

0 likes
0 replies

Please or to participate in this conversation.