Authenticate mobile applications with Laravel Sanctum

In this video we are going to take a look over how we can use Laravel Sanctum to provide token based authentication for mobile applications.

Install laravel sanctum:

composer require laravel/sanctum

Publish configuration and migration files:

php artisan vendor:publish --provider="Laravel\Sanctum\SanctumServiceProvider"

Run the migrations:

php artisan migrate

Add the HasApiTokens trait to the User class.

Setup routes: login, registration, logout, and user.

Create LoginControlle.r

Create RegistrationController.

Create LogoutController.

Point the routes to the correct controller actions.

Create an account to view the code snippets of this episode.