Documentation Index
Fetch the complete documentation index at: https://docs.mgpass.net/llms.txt
Use this file to discover all available pages before exploring further.
Overview
mgPass provides Single Sign-On (SSO) so users authenticate once and are automatically recognized across all connected applications. There are two SSO mechanisms depending on whether the application shares the.mgpass.net domain.
| Mechanism | When to use | How it works |
|---|---|---|
| Same-domain SSO | Apps on *.mgpass.net | Shared session cookie on .mgpass.net |
| Cross-domain SSO | Partner sites on other domains | FedCM (browser-native identity federation) |
Same-Domain SSO
All mgPass properties share the.mgpass.net parent domain:
auth.mgpass.net— authentication serveradmin.mgpass.net— admin consolemgpass.net— user account portal
mgpass_session cookie on the .mgpass.net domain. Because all mgPass properties are subdomains, the cookie is sent with every request automatically.
How It Works
User signs in
The user authenticates on any mgPass surface (e.g. the account portal at
mgpass.net). The auth-worker sets the mgpass_session cookie on .mgpass.net.User visits another mgPass property
The user navigates to
admin.mgpass.net. The session guard detects no local session.Silent authorization
The session guard auto-redirects to
auth.mgpass.net/authorize?prompt=none. Because the browser sends the shared .mgpass.net cookie, the auth-worker finds the active session.Code issued silently
The auth-worker issues an authorization code and redirects back to
admin.mgpass.net. No login UI is shown.Same-domain SSO is completely transparent to the user. The entire redirect chain happens in milliseconds and no login screen is ever displayed.
Session Cookie Details
| Property | Value |
|---|---|
| Cookie name | mgpass_session |
| Domain | .mgpass.net |
| Lifetime | 30 days (sliding window) |
| HttpOnly | Yes |
| Secure | Yes |
| SameSite | Lax |
Cross-Domain SSO
Applications on different domains (your apps, partner sites) cannot share cookies with.mgpass.net. For these, mgPass uses FedCM (Federated Credential Management) — a browser-native API where the browser itself mediates the identity check. No iframes, no third-party cookies, no custom UI.
How It Works
Request credentials
Your site calls
navigator.credentials.get() with the mgPass FedCM configuration (or loads the mgPass SDK which does this automatically).Browser checks session
The browser calls
auth.mgpass.net/fedcm/accounts with first-party cookies. This happens in the browser’s internal network stack — no JavaScript or iframes are involved.Native prompt shown
If the user has an active mgPass session, the browser displays a native account picker showing the user’s name, email, and avatar. If no session exists, nothing happens.
FedCM works without third-party cookies and is not affected by browser privacy features like Safari ITP or Firefox ETP. The browser mediates the entire flow — your site never communicates directly with the identity provider during the credential check.
Global Logout
When a user logs out from any mgPass surface, all sessions are destroyed everywhere. This is a security guarantee — there is no way to log out of a single app while remaining logged in elsewhere.What Happens
User triggers logout
The user clicks “Log out” on any connected application (admin console, account portal, or a partner app).
Redirect to auth-worker
The application redirects to
auth.mgpass.net/logout with an id_token_hint parameter.Back-channel logout
The auth-worker calls the admin and account workers via Cloudflare service bindings to destroy their local sessions immediately.
Implementing Logout
Redirect the user to the mgPass logout endpoint:| Parameter | Required | Description |
|---|---|---|
id_token_hint | Recommended | The user’s ID token. Helps mgPass identify the session without relying on cookies. Expired tokens are accepted (per OIDC spec). |
post_logout_redirect_uri | Optional | Where to redirect after logout. Must be registered in your application’s post_logout_uris. |
Session Lifetime
mgPass sessions use a 30-day sliding window:| Setting | Value |
|---|---|
| Default session duration | 30 days |
| Sliding window | Every SSO use (silent auth, token refresh) extends the session by 30 days |
| ”Remember me” checked | Persistent cookie with 30-day expiry (survives browser restart) |
| “Remember me” unchecked | Session cookie (cleared when browser closes) |
- Checked (default): Sets a persistent cookie. The user stays logged in across browser restarts and the 30-day window resets on every use.
- Unchecked: Sets a session cookie. Closing the browser ends the session regardless of the 30-day window.
Active users who interact with any mgPass-connected application at least once every 30 days will never need to re-authenticate.
Best Practices
Use FedCM for cross-domain SSO
Use FedCM for cross-domain SSO
For cross-domain SSO, use the FedCM integration (via the mgPass SDK or the direct browser API). The browser handles the session check and user prompt natively — no iframes, no third-party cookies, no custom UI needed.
Handle all callback states
Handle all callback states
Your OAuth callback handler must handle three outcomes:
code (success), error=login_required (no session), and error=consent_required (first-time app). Missing any of these causes a broken experience.Store the ID token for logout
Store the ID token for logout
Save the
id_token from the token exchange response. You need it for the id_token_hint parameter during logout. Expired tokens are accepted, so you do not need to keep a fresh one.Register post-logout URIs
Register post-logout URIs
Configure your application’s
post_logout_redirect_uris in the mgPass admin console. Without this, the user sees a generic “logged out” page instead of being redirected back to your app.Next Steps
- FedCM Integration — integrate cross-domain SSO with the browser-native FedCM API
- Token Refresh — keep users authenticated with automatic token renewal
- OAuth Flows — full details on the authorization code flow
- Applications — register your app to use SSO

