Token Storage
Token storage is used for accessing a Bearer token from the Laravel API for Echo private channel authorization requests.
Storage is used only when echo.authentication.mode
equals to token
.
How it works
Each token storage implements the following interface:
After the user sends credentials to the API module passes a token from the response to set
method as well as the current Nuxt application instance to allow calls like app.runWithConext()
.
Once the user logs out, the module sends undefined
as a token value to reset the stored value.
Before each request against the API, the module loads the token by calling get
method with the Nuxt instance passed.
Define token storage
You can define your own handler in the app.config.ts
configuration file and it will be automatically used by the module:
Now your application will store tokens in a local storage of your browser.
Keep in mind, localStorage
is available for CSR mode only.
Last updated