mirror of
https://github.com/stancl/tenancy-docs.git
synced 2025-12-12 18:24:03 +00:00
Add Sanctum integration page (#205)
This commit is contained in:
parent
2ce52d7f66
commit
ca2ee41ab4
3 changed files with 24 additions and 0 deletions
|
|
@ -206,6 +206,7 @@ return [
|
||||||
'Telescope' => 'integrations/telescope',
|
'Telescope' => 'integrations/telescope',
|
||||||
'Livewire' => 'integrations/livewire',
|
'Livewire' => 'integrations/livewire',
|
||||||
'Orchid' => 'integrations/orchid',
|
'Orchid' => 'integrations/orchid',
|
||||||
|
'Sanctum' => 'integrations/sanctum',
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
'Console commands' => 'console-commands',
|
'Console commands' => 'console-commands',
|
||||||
|
|
|
||||||
|
|
@ -15,3 +15,4 @@ If you're using the [automatic mode]({{ $page->link('automatic-mode') }}) & [mul
|
||||||
- [Laravel Nova]({{ $page->link('integrations/nova') }})
|
- [Laravel Nova]({{ $page->link('integrations/nova') }})
|
||||||
- [Laravel Telescope]({{ $page->link('integrations/telescope') }})
|
- [Laravel Telescope]({{ $page->link('integrations/telescope') }})
|
||||||
- [Livewire]({{ $page->link('integrations/livewire') }})
|
- [Livewire]({{ $page->link('integrations/livewire') }})
|
||||||
|
- [Laravel Sanctum]({{ $page->link('integrations/sanctum') }})
|
||||||
|
|
|
||||||
22
source/docs/v3/integrations/sanctum.blade.md
Normal file
22
source/docs/v3/integrations/sanctum.blade.md
Normal file
|
|
@ -0,0 +1,22 @@
|
||||||
|
---
|
||||||
|
title: Laravel Sanctum integration
|
||||||
|
extends: _layouts.documentation
|
||||||
|
section: content
|
||||||
|
---
|
||||||
|
|
||||||
|
# Laravel Sanctum {#sanctum}
|
||||||
|
|
||||||
|
> Note that the `sanctum` auth guard can't be used with [user impersonation]({{ $page->link('features/user-impersonation') }}) because user impersonation supports stateful guards only.
|
||||||
|
|
||||||
|
If you need to use the `csrf-cookie` route that Sanctum provides, you have to set up [universal routes]({{ $page->link('features/universal-routes') }}) in your app. Then, add `'routes' => false` to the `sanctum.php` config.
|
||||||
|
|
||||||
|
Finally, add the following code to `routes/tenant.php` (use tenancy initialization middleware of your choice):
|
||||||
|
|
||||||
|
```php
|
||||||
|
Route::group(['prefix' => config('sanctum.prefix', 'sanctum')], static function () {
|
||||||
|
Route::get('/csrf-cookie',[\Laravel\Sanctum\Http\Controllers\CsrfCookieController::class, 'show'])
|
||||||
|
// Use tenancy initialization middleware of your choice
|
||||||
|
->middleware(['universal', 'web', \Stancl\Tenancy\Middleware\InitializeTenancyByDomain::class])
|
||||||
|
->name('sanctum.csrf-cookie');
|
||||||
|
});
|
||||||
|
```
|
||||||
Loading…
Add table
Add a link
Reference in a new issue