Laravel & Ecosystem (50 Qs)•Part 3: Octane, High-Throughput Scaling & Enterprise Design (25 - 35)
API Authentication: Laravel Sanctum vs Passport.
senior LevelSecurity & AuthHTTP & REST APIs
In Simple Words:
- Laravel Sanctum: Featherweight authentication system for SPAs (Vue/React) and mobile apps. Uses cookie-based session authentication for SPAs (protecting against CSRF) and scoped bearer API tokens (
PersonalAccessToken) for mobile apps and third-party integrations. - Laravel Passport: Full-fledged OAuth2 server implementation (authorization codes, client credentials, refresh tokens). Use only when your platform acts as a public OAuth2 identity provider.