Overview
A JWT is used to identify the user when the widget loads. The product secret from Reditus is critical for signing this token and should never be exposed in front-end code. Instead, you will generate the token on your server and pass it to your client.Examples
Parameters
Parameter | Type | Description |
---|---|---|
SECRET | string | Required. The product secret obtained from your Reditus dashboard. Must never be exposed on the client side. |
PRODUCT_ID | string | Required. The unique product identifier from the Reditus configuration. |
USER_ID | string | Required. Your internal user identifier (e.g., database ID) that will be tied to referral data. |
tokenPayload | object | Payload for the JWT. In this example, includes ProductId , UserId , and iat . |
tokenPayload.iat | number | The current time in seconds (issued at). Ensures the token creation time is recorded. |
Usage
- Generate this token on your backend using the product secret and product ID.
- Send the token to your frontend (e.g., via an API response).
- Use the token in the auth_token parameter of the
gr("loadReferralWidget", ...)
(detailed in Loading the Widget).