API Authentication in Laravel with Vue & Sanctum: A Quick Guide
Aiming to master full-stack development? Pairing Laravel with Vue.js paves the path, particularly for authentication tasks.
In this guide, we'll delve into how Laravel, Vue, and Laravel Sanctum can be merged to craft an API authentication in two distinct methods:
Merging Laravel and Vue in a Single Page Application (SPA)
Using Vue and API as individual projects
Let’s get started.
Setting Up a Laravel Single Page Application with Breeze and Vue
First things first, create a new Laravel project. Run this command:
composer require laravel/breeze --dev
Run the following commands one after the other:
php artisan breeze:install vue
php artisan migrate
npm install
npm run dev
After this, you've got yourself a fully functional Single Page Application (SPA).