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.
@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.