Laravel Sanctum SPA API Authentication: Part 1

Laravel Sanctum is a lightweight package to help make authentication in single-page or native mobile applications as easy as possible. Where before you had to choose between using the web middleware with sessions or an external package like Tymon's jwt-auth, you can now use Sanctum to accomplish both stateful and token-based authentication.

Installing Laravel Sanctum

First, let's actually install the package using Composer: