Versions

Updated JWT Token to include user properties such as groupId and isAdmin

We updated the body that is sent to the https://api.velt.dev/generateveltauthtoken JWT Token endpoint to include user properties such as groupId and isAdmin.

The groupId field is used to validate that the groupId provided in the identify call is the same as the one passed to the JWT Token.

The isAdmin field is used to set a user as an admin.

FieldRequiredDescription
apiKeyYesVelt API Key
authToken YesAuth Token from the Velt console
userId YesUnique user id of the user
userProperties.groupIdNoIf groupId is provided, it will be validated with the groupId used in the identify call. Recommended if you are setting groupIds
userProperties.isAdminNoSet to true if you want to set user as admin. This is the only way to set a user as an admin User
{
  "data": {
    "apiKey": "YOUR_API_KEY", //Velt API Key
    "authToken": "YOUR_AUTH_TOKEN", // Auth Token from the Velt console
    "userId": "yourUserId", // unique user id of the user you are generating a JWT Token for
    "userProperties": {
        groupId: "YOUR_USER_GROUP_ID", // If groupId is provided here then we will validate it with the groupId used in the identify call
        isAdmin: true, // Set to true if you want to set user as admin
    }
  }
}

Option to force re-login user on identify call

By default when you identify a user, we maintain the user auth in the browser unless you explicitly change the logged in user with another identify call.

If you are granting a user additional access or have changed some metadata about the user and want those changes to be reflected immediately, then you should re-call the identify method with forceReset set to true.

await client.identify(user, {
  forceReset: true
});