Laravel sanctum and Vue-JS SPA: Unterschied zwischen den Versionen
Aus Froggis Wissenssammlung
Froggi (Diskussion | Beiträge) |
Froggi (Diskussion | Beiträge) Markierung: 2017-Quelltext-Bearbeitung |
||
| Zeile 8: | Zeile 8: | ||
| − | <code>axios.get('/sanctum/csrf-cookie').then(response => { | + | <code>axios.get('/sanctum/csrf-cookie').then(response => { |
| − | + | // Login... | |
| − | });</code> | + | });</code> |
| − | The | + | The login can be the standard login of Laravels scaffolding or a custom one. |
Aktuelle Version vom 13. August 2020, 13:35 Uhr
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.