Laravel sanctum and Vue-JS SPA
Aus Froggis Wissenssammlung
Version vom 13. August 2020, 13:35 Uhr von Froggi (Diskussion | Beiträge)
1. Install laravel sanctum
You may install Laravel Sanctum via Composer:
composer require laravel/sanctum
Now follow the instructions from https://laravel.com/docs/7.x/sanctum#installation to complete the installation. Especially look at the configuration.
2. Use it to authenticate a user
As described in the official docs do:
axios.get('/sanctum/csrf-cookie').then(response => {
// Login...
});
The loginn can be the standard login of Laravels scaffolding or a custom one.