setToken
Replace any existing token with a new one.
This method sets a JSON Web Token (JWT) to identify the user.
This is equivalent to calling the identify, but instead of specifying the user ID, you provide the token directly.
Passing null as the token has the same effect as calling the unsetToken method.
Signature
This method has the following signature:
croct.setToken(token: string | null): void
Example
Here is a basic example of how to use this method:
import croct from '@croct/plug';croct.setToken('eyJhbGciOiJIUzI1Ni...');
Parameters
The following list describes the supported parameters:
- tokenstring|null
The base64-encoded JSON Web Token (JWT) to identify the user.
Setting this parameter to null clears any previously specified token.