Skip to main content

Token SSO setup guide

  • May 15, 2020
  • 11 replies
  • 4091 views

Frank

What is Token SSO?

Token is a JWT-based authentication mechanism that provides simple and secure way to integrate any Service (Identity Provider) with Community (Service Provider)

Token SSO Flow Representation

In order to understand how the Token SSO process integrates into the overall Community SSO architecture (i.e. Steps #1-3 in the diagram below) please see Single Sign-on (SSO): Getting Started.

zvFHEmtmhdXZFz935v3Tx_a6TKAghp0qknvdkx29jljaBU4EEf-Lo4k6-ZVqeJAJHl63NZdIX0eBkKWS9aeMyYqNPWWZ5kaStOPgk1svXRAELwKArV8QlweYsUFzKvZ6oZLCn_5j

  1. Community redirects User to the Login URL with GET 

  2. Server authenticates the User and obtains consent/authorization.

  3. Server fetches user Profile data

  4. Server generates Token and sends it to Return URL with GET 

  5. Community receives Token, decodes and validates it by using Public Key and extracts Profile data

After retrieving the Profile dataCommunity starts #Step 3 of Community Single Sign-on.

 

How to Configure Token SSO on inSided

 

Server and Token generation

  • Generate pair of keys for Token signing (requires shell and openssl).
  • Check out the example below:

 

#!/usr/bin/env

openssl genrsa -out jwtRS256.key 2048
openssl rsa -in jwtRS256.key -pubout -outform PEM -out jwtRS256.key.pub

Set up a web Server with Login Endpoint that performs the following:

  1. Authenticate and authorize User.

  2. Fetch Profile data.

  3. Generate a signed Token (supported algorithms: RS256, RS384, RS512, ES256, ES384, ES512, HS256, HS384, HS512).

  4. Send the Request with GET by using Return URL in this format:
    (where customer-en should be replaced with the id of your community, which you can find in the control URL)

    1. If your instance is based in the EU:

      https://sso.api.insided.com/auth/token/return?token=[TOKEN]&customer=[customer-en]

       

    2. If your instance is based in the US: 

      https://sso-us-west-2.api.insided.com/auth/token/return?token=[TOKEN]&customer=[customer-en]

       

    3. If your instance is staging: 

      https://sso.api.almostinsided.com/auth/token/return?token=[TOKEN]&customer=[customer-en-staging]

       

    4. If your instance is in sandbox, please use EU/US URL and adding [customer-en-sandbox] to the end of the URL and not Staging.

Recommendations:

  • We recommend to use asymmetric algorithm, e.g. RSA256. Check out the example at the bottom of the article (token.php).
  • Here’s a useful resource that makes life easier when you work with JWT https://jwt.io

 

Note: JWE (Encryption) is not supported on inSided.

 

Community (inSided) configuration

  1. Log in to Control as an Administrator
  2. Go to Integrations > SSO > Token
  3. Fill in the following required fields:
    • Login URL: Login Endpoint URL
    • Public Key: Public key part from the previously generated pair of keys
  4. Press Install.

Once you’ve installed your configuration, we recommend using the built-in inSided SSO testing tool before you enable SSO for end users, to make sure everything is working as expected.

//token.php

<?php

//please install the package first https://github.com/firebase/php-jwt
use FirebaseJWTJWT;

//Read previously generated pair of keys
$privateKey = file_get_contents('jwtRS256.key');
//public key will be also needed as Public Key later in the Control Token configuration page
$publicKey = file_get_contents('jwtRS256.key.pub');

$payload = array(
'id' => 'VGqczRfTVaSm',
"username" => "john.doe",
'email' => 'john@doe.com',
"avatar" => "https://upload.wikimedia.org/wikipedia/commons/3/30/Rubik_cube.png",
"customRoles" => "12,13"
);

//Get token by signing it with private key
$token = JWT::encode($payload, $privateKey, 'RS256');
echo "Token: $token" . PHP_EOL;

//Decode it back for demo purposes
$payload = (array)JWT::decode($token, $publicKey, array('RS256'));
echo "Decoded payload: " . json_encode($payload) . PHP_EOL;

 

11 replies

  • Contributor ⭐️⭐️
  • June 23, 2021

A question — how do I update the button to say something other than “Login with Token” ? Having a hard time finding it in Phrases.

 

Thanks!

 

 


Cristina
Forum|alt.badge.img+1
  • Helper ⭐️⭐️⭐️
  • June 24, 2021

Hi @MackenzieK! The phrase for “Login with Token” is not in the list of default phrases in Control, but it can be added using the following:

Module.               Key.

Common

common.sso.oauth.login.token


Onomatopoeia
Forum|alt.badge.img
  • Helper ⭐️⭐️
  • October 26, 2021

@Cristina do you have the phrases for the rest of the copy on that popup?

  • Login to the community
  • Social login

Thanks!


Cristina
Forum|alt.badge.img+1
  • Helper ⭐️⭐️⭐️
  • October 26, 2021

Hi @Onomatopoeia! Sure, here they are:  

  • Login to the community: 

    Common

    login.detail.title

  • Social login

    Common

    sso.title


  • Contributor ⭐️⭐️⭐️
  • June 5, 2024

Where do I see ‘Control URL’ in the backend?


Kenneth R
Forum|alt.badge.img+5
  • Expert ⭐️⭐️
  • June 6, 2024

Hi@VarshaAhir - if you’re referring to this part:

Send the Request with GET by using Return URL in this format:
(where customer-en should be replaced with the id of your community, which you can find in the control URL)

...the control URL is simply the URL of your backend environment.  In that URL you’ll have an ID that looks something like ‘customer-en’.  For this community, for example, it’s ‘gainsight-us’.


Alistair FIeld
Forum|alt.badge.img+4

@Kenneth R and Team, I just noticed that there is the ability to define an avatar as well as username in the payload. So we can anonymize usernames and avatar.

 

This could be exactly what I am needing 😁


Jef Vanlaer
Forum|alt.badge.img+2
  • Helper ⭐️⭐️
  • May 2, 2025

Could JWT based authentication be used to directly register to and login to our Gainsight community when clicking on a community link inside our own software (securely transferring user data)? I’m absolutely no expert in this field, but I’m looking for ways to make it easier for our users to engage in the community (while we don’t have a central SSO system for all customers).

If anyone has done this or if there’s any documentation on how this is feasible, I’d love to hear about it 😀


Kenneth R
Forum|alt.badge.img+5
  • Expert ⭐️⭐️
  • May 6, 2025

Hey ​@Jef Vanlaer - I’ve not heard of something like that being done or attempted (I suspect it would be quite challenging to realize).  


Forum|alt.badge.img
  • Contributor ⭐️⭐️
  • November 27, 2025

Can the token SSO method be used in combination with another SSO method? The use case here would be having different methods in use for different audiences, internal and external.


revathimenon
Forum|alt.badge.img+8
  • Gainsight Community Manager
  • December 1, 2025

Hi ​@Ilona 

You can use a Custom Footer or inject the social icons via Third-party Scripts. I assume you will need a developer to do this since we don't have an option to easily add a social icon there.