A JSON Web Token (JWT) is an open standard that defines a compact and self-contained way of transmitting information between two parties as a JSON object.
Using JWT integration with HappyFox, you can build your own login portal or reuse an existing login portal for providing access to HappyFox support center. This way, your contacts do not need separate credentials to view their existing tickets or raise new tickets.
You can find more information about JWT here 🔖.
Applicable Plans: ✖️ Mighty ✔️ Fantastic ✔️ Enterprise ✔️ Enterprise Plus
Installing the JWT App in HappyFox:
- Log in to your HappyFox as an agent.
- Navigate to Apps >> Goodies >> Json Web Token (JWT).
- Click "Install".
- Provide the necessary values for the JWT Setup Fields.
- Click "Save Settings".
Enter the following details,
- Remote Login URL: This is the URL the client will be redirected to, if he/she logs into your HappyFox Support Centre.
- Remote Logout URL: This is the URL the client will be redirected to, once he/she logs out of your HappyFox Support Centre.
- Key: The Key field will be prepopulated with a 32 character alphanumeric string.
- Whitelisted domains: A security feature where only Domains whitelisted will be able to access HappyFox via JWT. All other domains will be restricted. To enable this feature, turn on the "Allow JWT login only from whitelisted domains" toggle.
- Client Redirect URL: This is the URL to which your authentication system must redirect the client to after login.
If custom domain is enabled for your account, login to the staff portal through the custom domain url, to get the correct Client Redirect URL.
Once the feature is enabled, the login link in your Support Centre will redirect the user to the Remote Login URL specified above. Similarly, when the user logs out, they will be redirected to the Remote Logout URL.
Setting up your JWT implementation:
To authenticate a user, you need to send the following values to HappyFox as part of your JWT request. Please learn more about how to make a valid JWT request from jwt.io.
- iat - Stands for Issued At. This is the time when the token was generated, this is used to help ensure that a given token gets used shortly after it's generated. The value must be the number of seconds since UNIX epoch.
- jti - Stands for JSON Web Token ID. A unique id for the token used to prevent token from being used multiple times (replay attacks).
- name - Name of the user logging in.
- email - Email address of the user logging in.
These values need to be encoded with the HS256 algorithm with the Secret Key that you get from the JWT integrations page in your HappyFox account as mentioned above. Once the payload is encoded, redirect the user to https://<accountname>.happyfox.com/jwt/?token=<payload>
Once HappyFox validates the payload, it will log the user into the Support Centre with the specified name/email.