The single sign-on identity layer for every Essential Nigeria product
Essential Auth is the single identity system for the Essential group. One account, one password, and one profile — usable across every Essential platform (ecars, eproperties, edirect, ejobs, emedicals, and dozens more). Your project authenticates users here, and gets verified identity data back in exchange.
There are two ways to integrate:
| Approach | When to use | Effort |
|---|---|---|
| A. Central SSO | Web apps, mobile apps, SPAs we build/control. Recommended for all internal products. | 30–60 minutes |
| B. OAuth 2.0 | Public apps, or a standard "Sign in with Essential Auth" button. | Requires OAuth client + scopes |
/api/..., all responses are JSON,
and all protected endpoints use Authorization: Bearer TOKEN. The human login page (for flow A)
lives at https://auth-front.edirect.ng/login.
Before users can log in, the auth service must recognise your platform code and the exact
redirect URI it will return to after login. This allowlist is enforced centrally and fails
closed — an unknown platform, or a URI not on the list, gets 403 Redirect URI is not allowed.
You're all set — just use your platform code (e.g. eproperties, ecars). A current
list of registered client platform codes: ecars, prideofnigeria, prideoftheworld, eproperties, edirect,
esupport, edrive, elogistics, ejob, edrivers, expense-tracker, ejobs, joblink, joblink-voucher,
interviewsessioncall, privatestaff, eservices, momogram, epolls, fastoffer, emedicals, emedicals-hrm,
emessenger, essentialnews, essentialgroup, autograph, evenue, eroot, ewallet, evideo, eaccademy,
momogram-eroot, fundpal, esecurity, ebooks, ebenefit, ewish, eauction, eschoolconnect,
eschoolconnect-med, ewish-eschoolconnect, ereligion, efixit, estores, ereport, elegal, hoteljobs,
ehotels, ehotels-inventory, whoiswho, ewish-tests.
You need your platform added before any developer can integrate. Do one of:
config/sso.php (see below)
and create your Platform record via the admin API.The admin creates/documents Platform records like this (DevOps only — protected by an admin role):
{
"platform_name": "My Great Product",
"platform_url": "https://myproduct.com",
"description": "What my product does",
"webhook_url": "https://myproduct.com/webhooks",
"default_commission_rate": 10,
"default_points_rate": 100,
"is_active": true
}
{
"success": true,
"message": "Platform created successfully. Please save the API key and webhook secret securely as they won't be shown again.",
"platform": {
"id": 1,
"platform_code": "my_great_product",
"api_key": "pk_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"webhook_secret": "whsec_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
...
}
}
api_key (used on platform-to-platform APIs)
and webhook_secret (used to sign webhook payloads) are shown once at creation and then hidden.
They can be regenerated by an admin if lost.config/sso.phpRedirect URIs are declared per environment (local, staging, production)
and matched exactly (a trailing slash is ignored, but prefixes are never accepted):
return [
'clients' => [
'eproperties' => [
'redirect_uris' => [
'local' => ['http://eproperties.test/auth/e-auth/callback'],
'staging' => ['https://staging.eproperties.com/auth/e-auth/callback'],
'production' => ['https://eproperties.com/auth/e-auth/callback'],
],
],
// ... add your platform here ...
],
];
The same platform code must be used for the allowlist entry, the platform field you send to the
API, and the platform your users are created under.
Works for web, mobile, or SPA. Your users get one identity across every Essential platform. A user who signs up on eproperties today can sign in on edirect tomorrow with the same email and password.
/api/auth/sso/initiate → receives a redirect_url.auth_code. The user logs in or registers.session_token, and redirects the browser back to your redirect_uri with ?session_token=...&state=....session_token with /api/auth/verify-sso-token and receives the verified user profile + a JWT for the auth API.Headers: Content-Type: application/json
{
"platform": "eproperties",
"redirect_uri": "http://eproperties.test/auth/e-auth/callback",
"state": "random_csrf_token_abc123"
}
platform must be registered. redirect_uri must exactly match an allowed URI for the current
environment. state is optional but strongly recommended to bind each attempt to your session.
curl -X POST https://auth.edirect.ng/api/auth/sso/initiate \
-H "Content-Type: application/json" \
-d '{"platform":"eproperties","redirect_uri":"http://eproperties.test/auth/e-auth/callback","state":"abc123"}'
Success (200):
{
"redirect_url": "http://e-auth.test/login?auth_code=AbCdEf123456...&platform=eproperties&redirect_uri=http%3A%2F%2Feproperties.test%2Fauth%2Fe-auth%2Fcallback&state=abc123"
}
Failures: 422 invalid/missing fields · 403 platform unknown or
redirect_uri not allowed · 500 auth login page not configured.
Send the browser to redirect_url (302 redirect server-side, or window.location in a
webview/SPA). On the auth login page the user signs in (or switches to Register and creates an account). The
login page never trusts a redirect_uri submitted by the browser — it always uses the one tied to the
auth_code, which makes tampering impossible.
auth_code is single-use and expires in
10 minutes. If it's used or expired you'll get 401 Invalid or expired authorization code —
just start a fresh initiate.Your backend calls this immediately after the initiate step (or when your app restores the flow). Two options:
Option 1 — The user's browser did the login/register on the auth page (most common).
You tell the API you trust the auth_code and claim a session:
{
"auth_code": "AbCdEf123456...",
"platform": "eproperties"
}
Option 2 — You already hold the user's credentials on your side. The API logs the user in as part of the exchange:
{
"auth_code": "AbCdEf123456...",
"platform": "eproperties",
"email": "user@example.com",
"password": "their_password"
}
Option 3 — The user already has an auth JWT from a previous session. Send it as a Bearer token:
Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9... with a body like Option 1.
Success (200):
{
"token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9...",
"session_token": "9f2c8d0a1b3c...",
"redirect_uri": "http://eproperties.test/auth/e-auth/callback",
"message": "SSO Login successful",
"user": {
"id": 4,
"userId": "...", "user_id": "...",
"platform": "eproperties",
"platform_user_id": "EPROPERTIES-1A2B3C4D",
"platform_role": "user",
"is_primary_account": true,
"primary_user_id": null,
"name": "Jane Doe", "first_name": "Jane", "last_name": "Doe",
"email": "jane@example.com", "phone": "+2348000000000",
"role": "user",
"referral_code": "...", "team_id": "...", "team_name": "..."
},
"platform": "eproperties",
"platform_role": "user",
"is_new_platform_account": false
}
What you get:
token — a JWT valid on the auth API (not your own API — see FAQ 8).session_token — the value your callback redirect carries. Valid 24 hours.redirect_uri — the authoritative return location; redirect the browser here.is_new_platform_account — true when a linked account was just auto-created for this platform.user, platform, platform_role — verified identity.The auth_code is consumed by this call, so call it only once. Then send the browser to:
http://eproperties.test/auth/e-auth/callback?session_token=9f2c8d0a1b3c...&state=abc123
state matches what you sent in Step 1, then validate the
session_token server-side in Step 4 before trusting the identity.{
"token": "9f2c8d0a1b3c...",
"platform": "eproperties"
}
curl -X POST https://auth.edirect.ng/api/auth/verify-sso-token \
-H "Content-Type: application/json" \
-d '{"token":"9f2c8d0a1b3c...","platform":"eproperties"}'
Success (200):
{
"user": {
"id": 4,
"name": "Jane Doe",
"first_name": "Jane",
"last_name": "Doe",
"email": "jane@example.com",
"phone": "+2348000000000",
"platform": "eproperties",
"role": "user"
},
"api_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9..."
}
Failures: 401 Invalid SSO token · 404 user no longer exists.
This returns the canonical profile (name, first_name, last_name,
email, phone) — use it to create or update the user on your side.
With the verified profile in hand, create your local user (or match by email) and mint your own session or JWT using your secret. Do not accept the auth JWT as your own — each product signs its own tokens.
This is the exact pattern deployed in eproperties. It uses illuminate/http (Laravel HTTP client) with the
auth service's base URL and platform code in config:
// config/api.php
'eauth_enabled' => env('EAUTH_SSO_ENABLED', false),
'eauth_url' => env('EAUTH_URL', 'http://e-auth.test'),
'eauth_platform' => env('EAUTH_PLATFORM', 'eproperties'),
// routes/web.php
Route::get('/auth/e-auth', [EAuthSsoController::class, 'redirect'])->name('eauth.redirect');
Route::get('/auth/e-auth/callback', [EAuthSsoController::class, 'callback'])->name('eauth.callback');
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Http;
use Illuminate\Support\Str;
class EAuthSsoController extends Controller
{
public function redirect()
{
$state = Str::random(32);
session(['eauth_state' => $state]);
// Step 1: initiate
$res = Http::post(config('api.eauth_url') . '/api/auth/sso/initiate', [
'platform' => config('api.eauth_platform'),
'redirect_uri' => route('eauth.callback'),
'state' => $state,
]);
if ($res->status() !== 200) {
return back()->with('error', 'SSO start failed: ' . $res->json('error'));
}
// Step 2: send the user to the auth login page
return redirect($res->json('redirect_url'));
}
public function callback(Request $request)
{
// Step 4 (guard first): state must match, session_token must be present
if (! hash_equals(session('eauth_state'), (string) $request->query('state'))
|| ! $request->has('session_token')) {
return redirect()->route('login')->with('error', 'SSO verification failed.');
}
$verify = Http::post(config('api.eauth_url') . '/api/auth/verify-sso-token', [
'token' => $request->query('session_token'),
'platform' => config('api.eauth_platform'),
]);
if ($verify->status() !== 200) {
return redirect()->route('login')->with('error', 'SSO verification failed.');
}
$identity = $verify->json('user');
// Step 5: upsert the user in YOUR database and log them in locally.
// Your LoginController must accept a $provider Verified identity
// ($identity['email'], $identity['first_name'], $identity['last_name']),
// auto-provisioning when the user doesn't exist yet.
return $this->loginWithProvider($identity);
}
}
And the button on the login page (rendered only when the feature is enabled):
Standard OAuth 2.0 Authorization Code flow (Laravel Passport) for public apps or when you specifically need standard OAuth. Requires registering an OAuth client first.
php artisan passport:client, orPOST /oauth/clientshttps://auth.edirect.ng/oauth/authorize?client_id=YOUR_CLIENT_ID&redirect_uri=YOUR_CALLBACK_URL&response_type=code&scope=&state=RANDOM_STATE
| Param | Required | Description |
|---|---|---|
| client_id | Yes | Your OAuth client ID |
| redirect_uri | Yes | Must match the registered redirect URI |
| response_type | Yes | code |
| scope | No | Comma-separated scopes, or empty |
| state | Recommended | CSRF protection token |
curl -X POST https://auth.edirect.ng/oauth/token \
-H "Content-Type: application/json" \
-d '{
"grant_type": "authorization_code",
"client_id": "YOUR_CLIENT_ID",
"client_secret": "YOUR_CLIENT_SECRET",
"redirect_uri": "YOUR_CALLBACK_URL",
"code": "AUTHORIZATION_CODE"
}'
{
"token_type": "Bearer",
"expires_in": 31536000,
"access_token": "OAUTH_ACCESS_TOKEN",
"refresh_token": "REFRESH_TOKEN"
}
curl https://auth.edirect.ng/api/auth/user/data \
-H "Authorization: Bearer OAUTH_ACCESS_TOKEN"
For mobile apps or backend-to-backend flows where you already hold credentials. Same identity system — the user's account is still primary/linked and usable everywhere else.
{
"first_name": "Jane",
"last_name": "Doe",
"email": "jane@example.com",
"password": "Password123",
"password_confirmation": "Password123",
"platform": "eproperties",
"phone": "+2348000000000"
}
Success (201) — profile, team, referral code/URL, wallet and virtual account (when provisioned):
{
"message": "Registration successful on eproperties.",
"user": { "id": 5, "email": "jane@example.com", "platform": "eproperties", "platform_role": "user", "is_primary_account": true, ... },
"team": { "id": 12, "name": "..." },
"referral": { "code": "ABC123", "url": "https://...", "platform": "eproperties", "referred_by": null },
"wallet": { "customer_code": "CUS_...", "wallet_id": "wlt_...", "synced_at": "2026-10-07 09:00:00" },
"virtual_account": null
}
{
"email": "jane@example.com",
"password": "Password123",
"platform": "eproperties"
}
Success (200): { "message": "Login successful", "token": "...", "user": {...} }.
Use Authorization: Bearer TOKEN for authenticated calls.
/api/auth/verify-email?token=... — verify a registered email/api/auth/email/resend — resend the verification email/api/auth/password/reset-request — request a reset link/code/api/auth/password/reset — perform the reset/api/auth/password/confirm — confirm current password/api/auth/change-password — change password (authenticated)| Method | Endpoint | Description |
|---|---|---|
| POST | /api/auth/sso/initiate | Start Central SSO; returns redirect_url |
| POST | /api/auth/sso/login | Complete Central SSO (exchange auth_code) |
| POST | /api/auth/verify-sso-token | Verify a session_token and return the user profile |
| GET | /api/auth/check-sso-session | Session check page used by the login form (one-time 5-min token) |
| POST | /api/auth/register | Register a user on a platform |
| POST | /api/auth/login | Direct login (throttled) |
| GET | /api/auth/verify-email | Verify email (token query param) |
| POST | /api/auth/email/resend | Resend verification email |
| POST | /api/auth/password/confirm | Confirm current password |
| POST | /api/auth/password/reset-request | Request password reset |
| POST | /api/auth/password/reset | Reset password |
| POST | /api/auth/auto-login | Code-based auto login |
| GET | /api/auth/verify/login/code | Verify auto-login code |
| GET | /api/check-session | Check session status |
| GET | /api/user/platforms | Platforms available to a user (email/phone) |
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/auth/user/data | Current authenticated user |
| POST | /api/logout | Logout (revoke session) |
| POST | /api/change-password | Change password |
| PUT | /api/platform/role | Update the user's role on a platform |
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/users/search?q=...&platform=... | Federated user search (used by eDirect AdeSearch) |
| GET | /api/users/{identifier} | Profile lookup by platform_user_id, referral code, or id |
| Method | Endpoint | Description |
|---|---|---|
| POST | /api/webhooks/{platformCode} | Ingest an event for a platform (authenticated with that platform's webhook secret) |
| Method | Endpoint | Description |
|---|---|---|
| POST | /api/commission/referral | Track a referral activity |
| POST | /api/commission/view | Track a view activity |
| POST | /api/commission/share | Track a share activity |
| POST | /api/commission/subscription | Track a subscription activity |
| POST | /api/commission/batch | Batch-track multiple activities |
| GET | /api/commission/earnings/{userId} | Earning summary for a user |
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/user/dashboard | User dashboard overview |
| GET | /api/user/payouts | List payouts |
| POST | /api/user/payouts/request | Request a payout |
| GET | /api/user/payouts/{payout} | Payout detail |
| GET | /api/user/leaderboard | Leaderboard |
| GET | /api/user/leaderboard/{period} | Leaderboard for a period |
| Method | Endpoint | Description |
|---|---|---|
| /api/admin/platforms | Full CRUD + restore/forceDelete for Platform records | |
| POST | /api/admin/platforms/{platform}/regenerate-api-key | Rotate a platform API key |
| POST | /api/admin/platforms/{platform}/regenerate-webhook-secret | Rotate a platform webhook secret |
| /api/admin/commission-rates | Manage commission-rate presets (+ bulk-update) | |
| /api/admin/activity-types | Manage activity types | |
| /api/admin/point-conversion-rates | Manage points conversion (+ preview) | |
| /api/admin/transactions | Approve / reject / reverse / bulk-approve | |
| /api/admin/payouts | Approve / complete / reject payouts | |
| GET | /api/admin/analytics/* | overview, platforms, activities, earnings, cohorts |
| /api/admin/webhook-logs | Logs, platform-stats, retry, bulk-retry, cleanup | |
| POST | /api/admin/leaderboard/refresh | Refresh leaderboard |
/api/auth/register endpoint) creates
the primary account first. You only need to call register yourself for backend-only sign-ups.is_primary_account: false and a primary_user_id pointing to the
primary. The whole family shares login credentials and, in Step 4, one canonical profile. Your platform only ever sees
its own linked account (platform, platform_user_id, platform_role).POST /api/admin/platforms (or the internal dashboard) and adds your platform code + callback
URI to config/sso.php for each environment. Ask your DevOps contact; this is a two-minute task for them.
If you maintain the auth repo yourself, you can do it directly using the payloads in Getting Started.403 Redirect URI is not allowed?redirect_uri is not on the allowlist for the current environment, or the platform code
isn't registered. The match is exact (trailing slash ignored) — https://app.com/callback and
https://app.com/callback/ are the same, but https://app.com/callback/extra is rejected, and so is a
different host or scheme. Double-check the environment: local, staging and
production each have their own allowed URIs.auth_code — generated by initiate; single-use;
expires in 10 minutes; powers Step 3. session_token — issued by sso/login (also the value
your callback URL carries); valid 24 hours; verified in Step 4. token/api_token — the JWT for
the auth API, minted by sso/login and verify-sso-token. The JWT is accepted only on the auth
service (see next question).JWT_SECRET, so
an e-auth token is only valid against e-auth endpoints. The eproperties integration solves this by exchanging the
verified identity (Step 4) for its own local JWT after signing the user in. Your app should do the same: verify with
e-auth, then mint your own session. Do not try to share one JWT across products.state and why is it recommended?state is a CSRF token you generate, keep in your own session, and compare when the browser
comes back to your callback. It proves the response belongs to a flow you started. Use a random string per
attempt and compare with a timing-safe comparison (hash_equals in PHP).redirect_url in a browser or
webview (OAuth-style out-of-band flow), the callback lands on your redirect URI, and your backend exchanges/verifies
exactly as the web example does. Register the callback URL for each environment in config/sso.php.sso/login response includes is_new_platform_account — true
when the linked platform account was just auto-created. Use it to trigger onboarding, profile completion, or a
welcome flow. The primary account may of course be older; that's normal and desired.403 — allowlist (platform registered? URI exact?
right environment?). 422 — validation (spelling of fields?). 401 — expired/used auth_code or
a wrong password. 500 — something is misconfigured server-side (e.g. app.eauth_login_url not
set); check me on Slack or ping the DevOps with your platform, your exact redirect_uri, and
the failing HTTP response.