Cookie Authentication
How to setup Sanctum cookie-based authentication for Laravel Echo.
Last updated
How to setup Sanctum cookie-based authentication for Laravel Echo.
Last updated
By default, the module provides configuration to integrate seamlessly with Laravel Sanctum authentication based on the XSRF token.
To explicitly set this authentication mode, update echo.authentication.mode
configuration property to cookie
.
You can check the official Laravel documentation here - .
Nuxt and Laravel applications must share the same top-level domain.
For instance:
Nuxt application - domain.com
Laravel application - api.domain.com
You should already have an authenticated user by submitting credentials to your login endpoint, for instance, using the module.
Once the module has an authentication state, it will request a CSRF cookie from the API, and pass it as an XSRF header to each Echo channel authorization request to confirm the current user identity.