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

akLearn's avatar

Sanctum vs Fortify ... they both authenticate??

If both Sanctum & Fortify authenticate then why are some people using them at the same time?

I was trying to implement Fortify as an authentication replacement for Laravel UI & I also need to setup APIs for front-end devs. I went through Google & people are using Sanctum along with Fortify to get the job done. Don't understand this.

I went through Laravel docs and they are saying both of these do authentication.

0 likes
4 replies
martinbean's avatar
Level 80

@aklearn Fortify is a headless authentication package. It gives you the functionality of stateful authentication, but none of the front-end. You have to build your views yourself.

Sanctum is typically used for authenticating SPAs. So it’ll enable a JavaScript front-end to get a cookie and authenticate against your API endpoints where you’d maybe have used a token before, and (insecurely) stored in a plaintext cookie or the user browser’s localStorage. But Sanctum doesn’t offer you functionality like user registration, password resetting etc. This is why you’d still use Fortify alongside Sanctum.

1 like
akLearn's avatar

@martinbean Why does Laravel say: "Laravel Sanctum provides a featherweight authentication system for SPAs"

If Sanctum isn't for authentication, then what are they really saying here?

martinbean's avatar

If Sanctum isn't for authentication, then what are they really saying here?

@akLearn Sanctum is for authentication. Where did I say it wasn’t?

Please or to participate in this conversation.