There are lots of packages available to authenticate the APIs request in Laravel. Such as Passport, **JWT, **and Sanctum. We are already familiar with **Laravel Passport **and JWT (JSON Web Token) to authenticate the APIs. Sanctum is introduced in Laravel 7 and really this is also a secured package. The Sanctum provides the authentication for the **SPA **(Single Page Application), mobile application, and the token-based APIs. In this post, we will be creating the Laravel 8 Sanctum auth for the token-based APIs. I have already shared the tutorial for creating RESTful APIs using Passport Authentication. The main difference between passport and sanctum is passport usage OAuth for the authentication. But, Sanctum generates the API tokens without the complication of OAuth.
Contents
Before creating this Laravel 8 Sanctum auth project, you will require to have the following tools.
#laravel 8 #laravel sanctum #restful apis #api