Single Sign-On (SSO) Integration Guide
This guide explains how to set up Single Sign-On (SSO) integration using a public key and encrypted user data.
Using SSO allows users to log in securely without entering their password manually.
How SSO Works
The SSO process includes the following:
Generate a public key for your domain
Encrypt user details using the public key
Generate the SSO URL using the encrypted token
Redirect the user to the generated URL for automatic login
Step 1: Generate a Public Key
Before using SSO, you need to generate a public key for your domain.
The public key is unique for each domain and is used to securely encrypt user data.
To generate a key:
Navigate to the SSO settings section in the panel
Click Generate Key
Enter your domain details
Save the configuration.


Additional Key Management Options
After generating a public key, you can also manage existing keys whenever required.
Edit a Public Key
You can update the following details of an existing key:
Domain
Status:
Active
Inactive
Note: Only active keys can be used for SSO encryption.
Delete the Generated Key (UI)
Keys can be deleted if no longer required. Once deleted, encryption using that key will no longer work.


Option A: Encrypt Data Using Custom Code (PHP)
You can generate the encrypted SSO token directly from your server using your public key.
A sample PHP script can be used to:
Encrypt the data using the public key
Generate a secure token
You may also implement the same logic in other programming languages based on your application requirements.
<?php |
Test Online: You can run this script at https://www.programiz.com/php/online-compiler/
Step 2: Generate the Final SSO URL
After encryption, you will receive a Base64 URL-safe encoded token.
Use this token in the following URL format:
<BASEURL>/sso?token=<encrypted_data>Example
https://control.msg91.com/sso?token=xxxxxxxxxxReplace:
<encrypted_data>with the generated encrypted token
Once the URL is created, redirect the user to it for automatic login.
Important Notes
Ensure your server date and time are accurate to avoid token validation issues
Always use the latest active public key for encryption
Tokens are time-sensitive, so users should be redirected immediately after token generation
Tokens generated using deleted or inactive keys will not work