implementing-admin-portal
Admin Portal with Scalekit
Adds a self-serve portal where customers configure their own SSO and SCIM settings — embedded inside your app's settings UI.
If the user only needs a quick shareable link with no code (e.g., for a one-time onboarding call), skip to the Shareable link section at the bottom.
Implementation progress
Admin Portal Implementation Progress:
- [ ] Step 1: Install SDK
- [ ] Step 2: Set environment credentials
- [ ] Step 3: Register app domain in dashboard
- [ ] Step 4: Generate portal link (server-side)
- [ ] Step 5: Render iframe (client-side)
- [ ] Step 6: Handle session expiry events
- [ ] Step 7: Verify portal loads and events fire correctly
Step 1: Install SDK
Detect the project's language/framework from existing files and install:
| Stack | Install |
|---|---|
| Node.js | npm install @scalekit-sdk/node |
| Python | pip install scalekit-sdk |
| Go | go get github.com/scalekit/scalekit-go |
| Java | Add com.scalekit:scalekit-sdk to pom.xml |
Step 2: Set environment credentials
Add to .env (never hardcode):
SCALEKIT_ENVIRONMENT_URL='https://<your-env>.scalekit.com'
SCALEKIT_CLIENT_ID='<CLIENT_ID>'
SCALEKIT_CLIENT_SECRET='<CLIENT_SECRET>'
Credentials are in Dashboard > Developers > Settings > API Credentials.
Step 3: Register app domain
In Dashboard > Developers > API Configuration > Redirect URIs, add the domain where the portal will be embedded. The iframe will be blocked if this is missing.
Step 4: Generate the portal link (server-side)
Generate a new link on every page load — links are single-use. Plug into the existing route or controller that serves the settings/admin page:
Node.js:
const { location } = await scalekit.organization.generatePortalLink(organizationId);
// Pass `location` to the frontend as a template variable or API response
Python:
portal = scalekit_client.organization.generate_portal_link(organization_id)
location = portal.location
# Pass `location` to your template or JSON response
Never cache this value — each link is single-use and will fail if reused.
Step 5: Render the iframe (client-side)
In the frontend settings/admin template, inject location as the src:
<iframe
src="{{ portalLink }}"
width="100%"
height="600px"
frameborder="0"
allow="clipboard-write"
></iframe>
Minimum recommended height: 600px. Match the variable name to the project's existing templating convention.
Step 6: Handle portal UI events
Listen for messages from the iframe to react to configuration changes and session expiry:
window.addEventListener('message', (event) => {
if (event.origin !== process.env.SCALEKIT_ENVIRONMENT_URL) return;
const { type } = event.data;
switch (type) {
case 'SSO_CONFIGURED':
// Refresh org status, show success banner, etc.
break;
case 'SESSION_EXPIRED':
// Re-fetch a new portal link and reload the iframe src
reloadPortalIframe();
break;
}
});
SESSION_EXPIRED handling is required — without it the portal silently breaks for long-lived sessions.
Step 7: Verify
- Open the settings page — confirm the iframe renders without console errors
- Complete a test SSO configuration inside the portal — confirm
SSO_CONFIGUREDfires - Wait for session expiry (or simulate it) — confirm
SESSION_EXPIREDtriggers a link refresh - Confirm portal link is never the same across two page loads (single-use verification)
Branding (optional)
Configure at Dashboard > Settings > Branding: logo, accent color, favicon. Custom domain support (e.g., sso.yourapp.com) is available in the Scalekit dashboard.
Guardrails
- Generate link server-side only — never expose
CLIENT_SECRETto the browser - Re-generate on every page load — caching will break the portal
- Register your domain in Redirect URIs before testing or the iframe will be blocked
- Handle
SESSION_EXPIRED— re-generate and reload, don't let it fail silently
Shareable link (no-code alternative)
For one-time onboarding calls or zero-engineering setup: go to Dashboard > Organizations, select the org, click Generate link, and share the URL directly. The link gives anyone who has it full access to configure that org's SSO/SCIM settings — use the iframe approach for production. Also share Scalekit's SSO setup guides so the IT admin has provider-specific configuration steps alongside the portal link.
More from scalekit-inc/skills
setup-scalekit
Use when a developer is new to Scalekit and needs guidance on where to start, doesn't know which auth plugin or skill to choose, wants to connect an AI agent or agentic workflow to third-party services (Gmail, Slack, Notion, Google Calendar), needs OAuth or tool-calling auth for agents, wants to add authentication to a project but hasn't chosen an approach yet, or needs to install the Scalekit plugin for their AI coding tool (Claude Code, Codex, Copilot CLI, Cursor, or other agents).
11implementing-scalekit-fsa
Implements Scalekit full-stack authentication (FSA) including sign-up, login, logout, and secure session management using JWT tokens. Use when building or integrating user authentication with the Scalekit SDK across Node.js, Python, Go, or Java — or when the user asks about auth flows, OAuth callbacks, token refresh, or session handling with Scalekit.
4integrating-agent-auth
Integrates Scalekit Agent Auth into a project to handle OAuth flows, token storage, and automatic refresh for third-party services (Gmail, Slack, Notion, Calendar). Use when a user needs to connect to an external service, authorize OAuth access, fetch access or refresh tokens, or execute API calls on behalf of a user.
4adding-mcp-oauth
Guides users through adding OAuth 2.1 authorization to Model Context Protocol (MCP) servers using Scalekit. Use when setting up MCP servers, implementing authentication for AI hosts like Claude Desktop, Cursor, or VS Code, or when users mention MCP security, OAuth, or Scalekit integration.
3modular-sso
Implements complete SSO and authentication flows using Scalekit. Handles modular SSO, IdP-initiated login, user session management, and enterprise customer onboarding. Use when adding authentication, SSO, SAML, OIDC, or user login to applications.
3sk-actions-custom-provider
Create or review Scalekit custom providers/connectors for proxy-only usage. Use this skill when the task is to gather API docs, infer whether a connector is OAuth, Basic, Bearer, or API Key, determine required tracked fields like domain or version, generate provider JSON, check for existing custom providers, show update diffs, run approved create or update curls, and print resolved delete curls.
3