If I understand correctly, you have an option with Sanctum. They recommend stateful authentication for SPAs, but you can use token-based authentication which is stateless.
Feb 6, 2022
1
Level 3
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?)
Please or to participate in this conversation.