Generate JWT Tokens for additional security
JWT Tokens
is an optional feature to add additional authentication security to our client.identify()
method to prevent user impersonation.
Enable JWT Tokens in your console
Require JWT Token
. The toggle is listed at the very bottom of the page.Create a server endpoint for generating and sending JWT Tokens to the client
JWT Token
to the client.Example server endpoint code:Generate a JWT Token using Velt's REST API
https://api.velt.dev/v1/auth/token/get
endpoint to generate a JWT Token
.Example server code:Field | Required | Description |
---|---|---|
apiKey | Yes | Velt API Key |
authToken | Yes | Auth Token from the Velt console |
userId | Yes | Unique user id of the user |
userProperties.organizationId | Yes | The ogranizationId should match the organizationId used in the identify call. |
userProperties.isAdmin | No | Set to true if you want to set user as admin . This is the only way to set a user as an admin User. Please do not set this property in the identify call as this will unset the isAdmin property. |
userProperties.email | No | If email is provided, it will be validated with the email used in the identify call. Recommended if you are setting email. |
Call your server endpoint from your client to pass your JWT Token to your client
JWT Token
to your client.Pass the JWT Token to identify()
client.identify()
method. The client.identify()
method has an optional second parameter that takes in a configuration object that includes the JWT Token
as a field.Refresh the JWT Token
token_expired
error eventerror
event to detect expired tokensidentify()
with the fresh token to re-authenticate the userYour All Done!
JWT Tokens
.