#Can you use both Laravel Passport & Laravel Sanctum?

7 messages · Page 1 of 1 (latest)

unique coral
#

@abstract sky No.

unique coral
#

Passport adds OAuth to your application.

#

If you want stateful, session-based authentication in your app then you’ll also need to use something like Fortify to add the controllers etc for that.

maiden hatch
#

The short version is: Need OAuth2? Use Passport. If not, use Sanctum.

But there really isn't a "you must use this for this", you can use one or the other for the same purpose. Sanctum just has some out of the box stuff for SPA authentication, but nothing stops you for implementing that yourself w/ Passport etc.

#

Sanctum is a preferred approach because of the simplicity. Also why it's included by default in the composer.json when making a new Laravel app

unique coral
#

Passport and OAuth is token-based authentication.