Category

How to Configure JWT-Based Single Sign-On (SSO) in BoldDesk

Updated:

JWT-based Single Sign-On (SSO) allows users to authenticate once through your organization’s identity provider and gain seamless access to the BoldDesk portal without re-entering credentials. After successful authentication, the system issues a digitally signed JSON Web Token (JWT). This acts as a secure, self-contained credential, like a digital passport, that carries verified user identity information. By using JWT SSO, organizations ensure a smooth and secure login experience while maintaining trust and control over user access. This guide outlines the steps to configure JWT (JSON Web Token) based Single Sign-On (SSO), enabling seamless, secure, and token-based authentication between your identity provider and the BoldDesk platform.


Check out this video for more details

What is a JSON Web Token (JWT)?

A JSON Web Token (JWT) is a compact, URL-safe token format defined by RFC 7519. It is used to securely transmit information between parties as a JSON object.

Key features of JWT

  • Digitally signed for integrity and authenticity.
  • Compact and easy to include in URLs and headers.
  • Carries all necessary user data (self-contained).

JWT Structure

A JWT consists of three Base64Url-encoded components, separated by periods (.). Each part plays a distinct role in ensuring secure and verifiable data exchange.

Token Structure Overview

Header.Payload.Signature

  1. Header

    Generally, the header, as the first part of the JWT, contains two fields:

    • The “alg” value indicates the encryption algorithm (for BoldDesk, this is RS256).
    • The “typ” value specifies the token type (in this case, JWT).
    {
    "alg": "RS256",
    "typ": "JWT"
    }
    

This section is Base64Url encoded.

  1. Payload (Claims)

    The payload is the second part of the JWT. It consists of the user’s identity information or other details (also in JSON format). In other words, this is where you put the actual user data or metadata exchanged securely.

    {
      "name": "John",
      "email": "[email protected]",
      "iat": 1545894207,
      "returnUrl": "/agent"
    }
    

This section is encoded in Base64Url and is readable by anyone. Do not include sensitive information.

  1. Signature

    The signature is the third part of the JWT that ensures the token’s integrity and authenticity.

    To generate the signature, concatenate (combine) the Base64Url-encoded Header and Payload using a period (.) as a separator, then sign the result using your RSA private key.

    RS256(
      privateKey,
      SHA256(base64UrlEncode(header) + "." + base64UrlEncode(payload))
    )
    

Result is Base64Url-encoded.

Generating RSA Keys (For RS256)

To use RS256 for signing JWTs, you’ll need a matching RSA key pair. That is:

  • Private key: Used to sign the token.
  • Public key: Used to verify the token’s signature.

Option 1. Use Online Tools

You can generate RSA keys using these tools:

Option 2. Command Line

Create RSA keys locally using ssh-keygen as follows:

# Generate the Private Key
ssh-keygen -t rsa -b 2048 -m PEM -f jwtRS256.key
# Use empty passphrase 
ssh-keygen -f jwtRS256.key.pub -e -m pem > jwtRS256_public.pem

To ensure secure JWT authentication, follow these key handling guidelines:

  1. Private key:
  • Use your RSA private key exclusively to sign JWTs.
  • This key is strictly for internal use within your organization.
  • Never share the private key outside your team.
  • Maintain tight control and secure storage to prevent unauthorized access.
  1. Public key: Share your RSA public key with the BoldDesk portal to enable JWT signature verification during login.

Example of a Complete JWT

When combined, the full JWT (JSON Web Token) looks like this:

eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiYWRtaW4iOnRydWUsImlhdCI6MTUxNjIzOTAyMn0.TCYt5XsITJX1CxPCT8yAV-TVkIEq_PbChOMqsLfRoPsnsgw5WEuts01mq-pQy7UJiN5mgRxD-WUcX16dUEMGlv50aqzpqh4Qktb3rk-BuQy72IFLOqV0G_zS245-kronKb78cPN25DGlcTwLtjPAYuNzVBAh4vGHSrQyHUdBBPM

RS256 is the exclusive signing algorithm supported by BoldDesk, as it offers greater security.


Required Claims for JWT Payload

Claim Description Data Type Example
email User Email - User’s email address (used as the primary identifier). String [email protected]
name Full Name - Full name of the user. String John Ben
iat Issued At - The UNIX timestamp when the token was issued. Helps determine token age. Number 1545894207

Optional Claims for JWT Payload

Claim Description Data Type Example
returnUrl When you need to redirect to a specific page after successful login String /agent

How JWT-Based Single Sign-on (SSO) Works

JWT SSO Setup in BoldDesk Portal

To enable JWT SSO in the BoldDesk system, follow the steps below:

  1. Log onto the administrator section of your BoldDesk portal.

  2. Go to Admin Settings > Customer Portal Settings.

  3. Switch to the Login configuration tab to manage authentication settings. You will be presented with the following fields:

    Field Description
    Authorization URL The endpoint where users are directed to authenticate via your identity provider.
    Redirect URL The BoldDesk URL that receives the JWT after authentication for session initiation.
    RSA Public Key The public key used by BoldDesk to validate the JWT signature for secure login.
    Logout URL (Optional) Destination URL for users after logging out from BoldDesk.
  • If the identity provider session remains active, users may be automatically signed in again when returning to the portal. Currently, login requests do not include logout-specific indicators or query parameters, so the system cannot distinguish between a standard login and a login that occurs after a sign-out.
  • During sign-out, the portal follows a predefined redirect priority. If a post-logout redirect URL is configured, users are redirected to that destination after signing out, and other configured logout URLs may not be invoked. This behavior is expected and designed to ensure a consistent sign-out flow.

Authentication Flow Using JWT

1. User Requests Access

When a user attempts to sign in to our BoldDesk portal, the system first checks if the user is authenticated. If not, and if JWT-based SSO is enabled, they are automatically redirected to your organization’s authentication page via the specified authorization URL.

Sample Authorization URL: https://xyzcompany.com/login/jwt/authenticate

2. User Login & Token Creation

Once the user successfully logs in via your Identity Provider, your system creates a JSON Web Token (JWT) containing user-specific claims like email, name, iat, and optionally returnUrl, signs it with your RS256 private key, and prepares to return it.

3. Redirection to Callback URL With JWT

The user is then sent back to BoldDesk, specifically to the configured callback address, with the freshly generated JWT included as a parameter.

Sample Redirect URL: https://YourBrandDomain.com/id/20250423143117/JWT/callback

The JWT is sent in the query string, typically as

https://YourBrandDomain.com/id/20250423143117/JWT/callback?token=eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiYWRtaW4iOnRydWUsImlhdCI6MTUxNjIzOTAyMn0.TCYt5XsITJX1CxPCT8yAV-TVkIEq_PbChOMqsLfRoPsnsgw5WEuts01mq-pQy7UJiN5mgRxD-WUcX16dUEMGlv50aqzpqh4Qktb3rk-BuQy72IFLOqV0G_zS245-kronKb78cPN25DGlcTwLtjPAYuNzVBAh4vGHSrQyHUdBBPM

4. Token Validation & User Login

Upon receiving the JWT, BoldDesk uses the public key that you previously uploaded to check the authenticity of the token.

If the token is valid:

  • The claims are extracted.
  • A new session is created. The user is logged in automatically.

If validation fails (e.g., invalid signature, expired token, or missing claims), access is denied.

If a confirmation screen appears immediately after JWT SSO (e.g., “Remember me”), it’s controlled by your Identity Provider (IdP)—not BoldDesk. To suppress or change it, update your IdP’s session/consent policies (e.g., disable the prompt or adjust session persistence).

5. Logout Flow (Optional)

You can optionally configure a Logout URL so that users are redirected to your system after they log out from our platform.

BoldDesk does not support session-based login via API for browser access. This approach is intentionally restricted due to the following security and platform limitations:

  • Credential Exposure: Storing or transmitting login credentials through software can lead to unauthorized access and compromise account security.
  • Session Hijacking: Injecting or passing session IDs via URLs or scripts increases the risk of interception and misuse.
  • Audit & Accountability: Shared or automated logins obscure individual user activity, impacting compliance and audit tracking.

For secure access, please use the standard authentication methods provided by BoldDesk.

Troubleshooting JWT SSO Signature Validation

This usually occurs when the public and private keys used for signing and validating the token do not match. Please verify the following:

  • Ensure that the correct private/public key pair is being used for token generation and validation.
  • When generating RSA keys, use a key size of at least 1024 bits (we strongly recommend 2048 bits for improved security).

After confirming the keys, please try logging in again.

Frequently Asked Questions

  1. What signing algorithm must the JWT use for BoldDesk JWT SSO?
    BoldDesk supports RS256 only. JWTs signed with other algorithms are not supported in this guide.

  2. Which JWT claims are required for BoldDesk to create a session?
    The required payload claims are email, name, and iat.

  3. What does BoldDesk use as the primary user identifier?
    BoldDesk uses the email claim as the primary identifier.

  4. How does BoldDesk receive the JWT from the identity provider?
    BoldDesk receives the JWT at the configured Redirect URL via a query string parameter (example format: ...?token=<JWT>).

  5. Can I include sensitive data in the JWT payload?
    No. The payload is Base64Url-encoded and readable by anyone who obtains the token. Only include non-sensitive claims required for authentication and routing.

  6. What does the returnUrl claim do?
    returnUrl is an optional claim used to redirect the user to a specific page after successful login (example: /agent).

  7. Why does the user get logged in again immediately after logging out?
    If the identity provider session is still active, returning to the BoldDesk portal can trigger an automatic sign-in. The guide states BoldDesk login requests do not include logout-specific indicators.

  8. What should I check if BoldDesk says the JWT signature is invalid?
    Verify the RSA private key used to sign the JWT matches the RSA public key uploaded to BoldDesk. Also, confirm the key size is at least 1024 bits (2048 recommended).

Related Articles

  1. Troubleshooting: Restore Portal Access After an SSO Client Secret Expires
  2. How to Set Up Single Sign-On (SSO) in BoldDesk
Was this article useful?
Like
Dislike
Help us improve this page
Please provide feedback or comments
Comments (0)
Access denied
Access denied
Access denied
Access denied

No articles or sections found
No articles or sections found