Laravel sanctum and Vue-JS SPA

Aus Froggis Wissenssammlung
Wechseln zu:Navigation, Suche

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 login can be the standard login of Laravels scaffolding or a custom one.