Back to Home

SSO Platform Documentation

Version 1.0 — Last updated August 2026

Overview

SSO Platform is a centralised Single Sign-On platform. It lets users register once and access multiple systems using a single identity. Authentication is handled via email OTP — no passwords to store or manage.

Integration is simple: register your system in the admin panel, receive a secret key, and add a single PHP callback file to your application.

OTP-based auth: Users receive a 6-digit code by email valid for 5 minutes. No passwords are stored anywhere in the system.

Quick Start

Get a system integrated in 3 steps:

User Registration

New users register at /register.php. They provide name, email, phone, and optionally upload a face photo and staff card for verification.

Accounts are in pending status until an admin approves them. Rejected accounts cannot sign in.

Email domain restriction can be configured in admin Settings to only allow specific company domains (e.g. company.com.my).

Register a System

In the admin panel, go to Systems → Register New System and fill in:

FieldRequiredDescription
System NameYesDisplay name shown on user dashboard
Base URLYesRoot URL of your application (e.g. https://app.example.com)
Redirect URLYesFull URL of your SSO callback file (e.g. https://app.example.com/sso-callback.php)
System LogoNoJPG/PNG/SVG shown on dashboard card
DescriptionNoShort description shown on dashboard

On save, a unique secret key is generated. Keep this private — it is used to verify tokens.

Download Integration Guide

From the Systems table, the Guide column has two download buttons per system:

The .php file is named sso-callback-{slug}.php. Rename and place it at your Redirect URL path.

Callback File

When SSO redirects a user to your app, it appends ?sso_token=TOKEN to your Redirect URL. Your callback file must verify this token before granting access.

<?php
// sso-callback.php
$sso_token  = $_GET['sso_token'] ?? '';
$secret_key = 'YOUR_SECRET_KEY';
$verify_url = 'https://www.sso.krh.com.my/verify-token.php';

if (!$sso_token) exit('No token.');

$response = file_get_contents(
    $verify_url . '?token=' . urlencode($sso_token)
               . '&secret=' . urlencode($secret_key)
);
$data = json_decode($response, true);

if (!$data || !$data['ok'])
    exit('SSO failed: ' . ($data['error'] ?? 'Unknown'));

$user = $data['user'];
session_start();
$_SESSION['user_id']    = $user['id'];
$_SESSION['user_name']  = $user['name'];
$_SESSION['user_email'] = $user['email'];

header('Location: /dashboard');
exit;
Never expose your secret key in client-side code or commit it to a public repository.

Verify Token API

Your callback calls this endpoint to validate an SSO token.

GET https://www.sso.krh.com.my/verify-token.php

Query Parameters

ParameterRequiredDescription
tokenYesThe sso_token value from the redirect URL
secretYesYour system's secret key from the admin panel

Response Format

The endpoint always returns JSON.

Success

{
  "ok": true,
  "user": {
    "id": 1,
    "name": "Ahmad Ali",
    "email": "ali@example.com"
  }
}

Failure

{
  "ok": false,
  "error": "Invalid or already used token"
}

Error Codes

HTTPError MessageCause
400Missing token or secretRequired parameters not provided
401Invalid or already used tokenToken does not exist or was already consumed
401Token has expiredToken older than 5 minutes
403Invalid secret keySecret does not match the system that owns the token
403User account is not activeUser was rejected or deactivated after token was issued
405Method not allowedOnly GET requests are accepted

User Management

Access at /admin/users.php. Admin can:

System Management

Access at /admin/systems.php. Admin can:

Access Control

Each system can be set to All Approved Users or Specific Users. Click the Access button in the systems table to manage.

Users without access see a message on the dashboard and are blocked before any token is issued.

Settings

Landing Page

SMTP

Configure SMTP for OTP email delivery. TLS (port 587) and SSL (port 465) supported. Use Test Connection to verify before saving.

Allowed Domains

Comma-separated email domains allowed to register. Leave blank to allow all.

Security Model

Token Lifecycle

Always verify ok === true before starting a session. Never grant access on a failed or missing response.
Still have questions?
Read the flow walkthrough or contact your system administrator.
How it Works →