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

kenzine's avatar

Integrating Laravel Passport with Inertia/React

Has anyone managed to successfully do the above before? I would like to see your ApiController and routes.

I am frustrated by the lack of resources on this, as online tutorials on Laravel Passport only demonstrate the backend functionality and accessing the routes through Passport. Meanwhile, Laravel Breeze starter kit to set up Inertia/React uses Sanctum instead.

For context, I want to create a Laravel/Inertia/React application which enables a user to login and is immediately redirected to a dashboard page which is protected by the "auth:api" middleware by Laravel Passport.

Appreciate any and all help, thanks!

0 likes
1 reply
martinbean's avatar

@kenzine You’re probably struggling to find resources because you’re trying to do something entirely the wrong way.

Passport is an OAuth server implementation. It allows you to issue OAuth access tokens. Inertia is for building “full stack” SPAs that authenticate using “normal” session-based authentication and not API tokens. So you seem to be trying to use Passport for completely the wrong purpose.

Please or to participate in this conversation.