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

cooperino's avatar

Using Sanctum to authenticate users on SPAs - stateless vs stateful

I was just reading about the benefits of token based authentication and one of them is that it's stateless thus the server needs less resources.

But Laravel recommends using Sanctum which uses its session based authentication. Does it mean it's still stateful even if I'm using it for SPA authentication?

If yes, then out of curiosity, what is a recommended way to authenticate users in a stateless way for SPAs? Passport uses OAuth2 which isn't meant for that purpose (Or is it?)

0 likes
1 reply

Please or to participate in this conversation.