Overview
The mgPass One Tap SDK enables cross-domain SSO for partner sites. If your users have an active mgPass session, the SDK displays a floating “Continue as [Name]” banner that lets them sign in with a single click — no password, no redirect chain, no friction. If no mgPass session exists, the SDK is completely invisible. It adds no UI, no prompts, and no overhead.One script tag
Add a single
<script> tag and call mgpass.onetap() with your client ID.Zero friction
Users click once to authenticate. No login form, no password entry.
Privacy-first
No tokens or session IDs are exposed. Only basic profile info is shared.
Invisible when inactive
If the user has no mgPass session, nothing is shown. Your page is unaffected.
Quick Start
Add the SDK to any page where you want to offer One Tap sign-in:Configuration Options
| Option | Type | Required | Default | Description |
|---|---|---|---|---|
client_id | string | Yes | — | Your OAuth client ID from the mgPass admin console |
redirect_uri | string | Yes | — | Where to redirect after authentication. Must be registered in your app’s allowed redirect URIs. |
scope | string | No | openid profile email | OAuth scopes to request |
How It Works
SDK loads
The
onetap.js script loads and registers the mgpass.onetap() function on the global mgpass object.Hidden iframe created
The SDK creates a hidden iframe pointing to
auth.mgpass.net/onetap/check. Because the iframe is on the auth.mgpass.net origin, it can read the mgpass_session cookie (same-origin policy).Session check
Inside the iframe, JavaScript checks for the
mgpass_session cookie and validates the session. A 5-second timeout is enforced — if the iframe does not respond, it is cleaned up silently.Result posted to parent
The iframe posts the result to the parent page via
postMessage:- Session found:
{ authenticated: true, user: { name, email, avatar } } - No session:
{ authenticated: false }
Banner shown (if session exists)
If an active session was found, the SDK renders a floating banner in the bottom-right corner displaying the user’s name, email, and avatar with a “Continue as [Name]” call to action.
User clicks the banner
Clicking the banner redirects to
auth.mgpass.net/authorize with prompt=none and the configured client_id, redirect_uri, and scope. Because the session exists, the auth-worker issues an authorization code instantly.Banner Behavior
The One Tap banner appears in the bottom-right corner of the page with a slide-in animation.What the banner shows
- User’s avatar (or initials fallback)
- User’s display name
- User’s email address
- “Continue as [Name]” button
- Close button (X) in the top-right corner
- “Secured by mgPass” branding at the bottom
Dismiss behavior
- Clicking the X button dismisses the banner for the current browser session (tracked in
sessionStorage). - Navigating to a new page on your site where the SDK is loaded will not re-show the banner if the user dismissed it.
- Closing and reopening the browser clears
sessionStorage, so the banner will appear again on the next visit.
When nothing is shown
The SDK is completely invisible when:- No active mgPass session exists
- The user previously dismissed the banner (current browser session)
- The iframe times out after 5 seconds (network issues)
Security
Sandboxed iframe
Sandboxed iframe
The hidden iframe uses
allow-same-origin allow-scripts sandbox attributes. It cannot navigate the parent page, submit forms, or access parent DOM.postMessage origin verification
postMessage origin verification
The SDK verifies that every
postMessage event originates from auth.mgpass.net. Messages from any other origin are ignored.No sensitive data exposed
No sensitive data exposed
The iframe only sends basic profile information (name, email, avatar) to the parent page. Tokens, session IDs, and cookies are never exposed to the partner site.
No URL parameter leakage
No URL parameter leakage
User data is passed via
postMessage, not URL parameters. Nothing is exposed in browser history, server logs, or referrer headers.Automatic cleanup
Automatic cleanup
The iframe has a 5-second timeout. If no response is received (e.g. the user has third-party cookies blocked), the iframe is removed from the DOM silently.
Advanced Usage
Programmatic Dismiss
You can hide the banner programmatically (e.g. when the user starts interacting with your own login form):Handling the Callback
After the user clicks the banner and completes the OAuth flow, they arrive at yourredirect_uri with an authorization code:
Styling
The banner uses inline styles with fixed positioning. It does not interfere with your page layout or existing CSS.| Property | Value |
|---|---|
| Position | Fixed, bottom-right corner |
| Z-index | 999999 |
| Width | 360px |
| Animation | Slide-in from bottom |
| Shadow | Subtle drop shadow |
Browser Support
The One Tap SDK works in all modern browsers that support:postMessageAPIsessionStorage<iframe>with sandbox attributes
Next Steps
- SSO Guide — understand same-domain and cross-domain SSO architecture
- OAuth Flows — full details on the authorization code flow
- Token Refresh — keep users authenticated with automatic token renewal

