Overview
mgPass implements OAuth 2.0 and OpenID Connect (OIDC) for authentication and authorization. Choose the flow that matches your application type.| Flow | Use Case |
|---|---|
| Authorization Code | Traditional web apps with a backend |
| Authorization Code + PKCE | SPAs and mobile/native apps |
| Client Credentials | Machine-to-machine (M2M) |
| Refresh Token | Renewing expired access tokens |
Discovery Endpoint
The OIDC discovery document provides all endpoint URLs and supported features:Authorization Code Flow
Best for traditional web applications with a server-side backend.Redirect to authorize
Redirect the user to the authorization endpoint:
| Parameter | Required | Description |
|---|---|---|
response_type | Yes | Must be code |
client_id | Yes | Your application’s client ID |
redirect_uri | Yes | Must match a registered redirect URI |
scope | Yes | Space-separated scopes (include openid for OIDC) |
state | Recommended | CSRF protection value |
User authenticates
mgPass displays the sign-in screen. The user authenticates with email/password or a social connector. If consent is required, a consent screen is shown.
Receive authorization code
After successful auth, mgPass redirects to your
redirect_uri with a code:Authorization Code + PKCE
Required for SPAs and mobile apps that cannot securely store a client secret.Client Credentials Flow
For server-to-server (M2M) communication where no user is involved.Client credentials tokens do not include a
refresh_token or id_token since there is no user context.Refresh Token Rotation
When an access token expires, use the refresh token to get a new pair:Silent Authentication (prompt=none)
The prompt=none parameter lets you check if a user has an active mgPass session without showing any login UI. This is the foundation of cross-domain SSO and a fallback mechanism for token refresh.
Request:
| Outcome | Redirect | Next Step |
|---|---|---|
| User has active session and has authorized the app | ?code=AUTH_CODE&state=... | Exchange code for tokens |
| No active session | ?error=login_required&state=... | Show login button or redirect without prompt=none |
| Active session but first-time app | ?error=consent_required&state=... | Redirect without prompt=none to show consent |
prompt=none:
- SSO check on page load — silently check if the user is already logged in on another MG Digital property
- Token renewal fallback — when a refresh token has expired, try silent auth before showing a login screen
- Session validation — periodically confirm the user’s mgPass session is still active
The
prompt=none request is a browser redirect, not a background API call. The user briefly sees a redirect to mgPass and back, but no login UI is shown.Remember Me
The mgPass login screen includes a “Remember me for 30 days” checkbox that controls session persistence:| Setting | Cookie Type | Behavior |
|---|---|---|
| Checked (default) | Persistent cookie (30-day expiry) | User stays logged in across browser restarts. Session extends on each use (sliding window). |
| Unchecked | Session cookie | Session ends when the browser is closed. User must sign in again next time. |
The “Remember me” preference only applies to the mgPass session cookie. It does not change access token or refresh token lifetimes, which are configured per-application.
Scopes
| Scope | Description |
|---|---|
openid | Required for OIDC, returns an ID token |
profile | User profile claims (name, avatar, etc.) |
email | Email address and verification status |
phone | Phone number and verification status |
offline_access | Include a refresh token |
| Custom scopes | Defined per API resource (e.g., stream:live) |

