/saaskit:implement-ssofrom saaskit
Implements Modular SSO so an agent can add SAML/OIDC, IdP-initiated login, and the admin portal. Use when the user wants SSO, SAML, OIDC, Modular SSO, or IdP. It does not write SaaSKit login (that's `implement-saaskit`) or provision users from a directory (that's `implement-scim`).
Ships in saaskit. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Add SAML/OIDC, IdP-initiated login, and the admin portal. Then stop.
connectionId, organizationId, or loginHint.redirectUri identical to the dashboard Allowed callback URL.validateToken before using claims.relay_state as state on IdP-initiated login.npm install or start the server.implement-saaskit and stop. Modular SSO or FSA, not both./settings/authentication-mode.SCALEKIT_ENVIRONMENT_URL, SCALEKIT_CLIENT_ID, SCALEKIT_CLIENT_SECRET. Never SCALEKIT_ENV_URL. Do not prepend https:// if the URL already has a scheme.openid profile email. Modular SSO does not support offline_access. Do not write refresh tokens or SaaSKit cookies.connectionId > organizationId > loginHint. domainHint also works. Without a selector Scalekit cannot pick an IdP.org_… values.If the app already uses SaaSKit or Full-Stack Auth login, name implement-saaskit and stop.
Print this checklist. Ask the human to write missing SCALEKIT_ENVIRONMENT_URL, SCALEKIT_CLIENT_ID, and SCALEKIT_CLIENT_SECRET into .env. Then write the routes.
/auth/callback (local default http://localhost:3000/auth/callback)/login (local default http://localhost:3000/login)Do not invent those env values. Do not invent org_… IDs.
Done when: this skill is the right path, the three env names exist, and both redirect URL names are listed.
Write the @scalekit-sdk/node import. Do not run npm install.
import { ScalekitClient } from '@scalekit-sdk/node';
const scalekit = new ScalekitClient(
process.env.SCALEKIT_ENVIRONMENT_URL,
process.env.SCALEKIT_CLIENT_ID,
process.env.SCALEKIT_CLIENT_SECRET
);
const redirectUri = 'http://localhost:3000/auth/callback';
Use the same redirectUri string that is registered in Step 1.
Done when: the client initializes from those env vars.
Pass one selector. Empty query fails.
app.get('/auth/login', (req, res) => {
const { connectionId, organizationId, loginHint, domainHint } = req.query;
const authorizationUrl = scalekit.getAuthorizationUrl(redirectUri, {
connectionId,
organizationId,
loginHint,
domainHint,
scopes: ['openid', 'profile', 'email'],
});
res.redirect(authorizationUrl);
});
Done when: /auth/login redirects to that URL with one selector.
/loginRegister this exact URL as Initiate login URL.
app.get('/login', async (req, res) => {
const { idp_initiated_login, error, error_description } = req.query;
if (error) return res.status(400).send(error_description);
const claims = await scalekit.getIdpInitiatedLoginClaims(idp_initiated_login);
const authorizationUrl = scalekit.getAuthorizationUrl(redirectUri, {
connectionId: claims.connection_id,
organizationId: claims.organization_id,
loginHint: claims.login_hint,
state: claims.relay_state,
scopes: ['openid', 'profile', 'email'],
});
res.redirect(authorizationUrl);
});
Done when: /login reads idp_initiated_login and redirects with relay_state as state.
Use the same redirectUri as Step 3. The app creates its own session after validation.
app.get('/auth/callback', async (req, res) => {
const { code, error, error_description } = req.query;
if (error) return res.status(400).send(error_description);
const result = await scalekit.authenticateWithCode(code, redirectUri);
await scalekit.validateToken(result.idToken);
await scalekit.validateToken(result.accessToken);
// Create the app's own session from result.user.
res.redirect('/dashboard');
});
Do not write SaaSKit HttpOnly cookies. Modular SSO does not return a refresh token.
Done when: the callback exchanges code, validates both tokens, and the app session exists.
Print this checklist. Do not start the app. Do not open the simulator.
organization_id or connection_id. Domains are example.com and example.org./auth/login with one of: organizationId=<id>, connectionId=<id>, or [email protected]Done when: the human has the simulator checklist.
Shareable link (no code): Dashboard → Organizations → the org → Generate link. Send that URL plus the matching SSO setup guide to the customer's IT admin. Open references/providers.md for Okta, Entra ID, Google Workspace, and JumpCloud.
Embed: register the page origin under Authentication → Redirects → Allowed callback URLs. Generate the link server-side on every load. Links are single-use. orgId is the customer's organization ID from the dashboard.
const portalLink = await scalekit.organization.generatePortalLink(orgId);
res.json({ portalUrl: portalLink.location });
<iframe src="${portalUrl}" width="100%" height="600" frameborder="0" allow="clipboard-write"></iframe>
On message, if event.data.event_type is PORTAL_SESSION_EXPIRY, generate a new link and set iframe.src. Do the same for PORTAL_LOAD_FAILURE when data.error_code is SESSION_EXPIRED.
Done when: a shareable link can be generated, and the iframe uses a fresh portalLink.location.
Write the Node files and stop. Do not run npm install. Do not start the server. Name implement-scim only if the user wants directory provisioning.
Done when: SAML/OIDC, IdP-initiated /login, and the admin portal are in the repo, and this skill has stopped.
implement-saaskit if the app wants SaaSKit login insteadimplement-scim to provision users from a directoryWhat SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub scalekit-inc/authstack --plugin saaskit15 skills in this plugin
/add-api-authAdds API key or client-credentials auth so an agent can protect an API. Use when the user wants an API key or client credentials. It does not put OAuth 2.1 on an MCP server (that's `add-mcp-oauth`) or write SaaSKit login (that's `implement-saaskit`).
/add-mcp-oauthAdds MCP OAuth so an agent can protect the user's MCP server. Use when the user wants MCP OAuth or to protect their MCP server. It does not add API keys or client credentials (that's `add-api-auth`) or expose AgentKit tools over MCP (that's `expose-agentkit-mcp`).
/check-saaskit-prodChecks SaaSKit production so an agent can finish a go-live checklist. Use when the user wants SaaSKit production or to go live SaaSKit. It does not write login (that's `implement-saaskit`) or run dryrun (that's `run-dryrun`).
Other plugins' skills for the same job