implement-saaskit-python
Installation
SKILL.md
Implement SaaSKit Python
Add login, callback, an encrypted sk_session cookie, logout, and refresh in FastAPI. Then stop.
Guardrails
- MUST keep
SCALEKIT_REDIRECT_URI, the dashboard Redirect URI, and the process host:port the same string. - MUST call
auth.install(app).app.include_router(auth.router)alone skips the 302 handler. - MUST set
cookie_secure=Falseon local HTTP. MUST set itTruein production. - MUST treat
returnToas a relative path only (/..., not//…). The adapter already sanitizes it.
Gotchas
setup-saaskitalready wrote env and registered the redirect. Start there.- Read
SCALEKIT_ENVIRONMENT_URL,SCALEKIT_CLIENT_ID,SCALEKIT_CLIENT_SECRET, andSCALEKIT_REDIRECT_URI. NeverSCALEKIT_ENV_URL. Do not prependhttps://. - Also need
COOKIE_ENCRYPTION_SECRET(openssl rand -base64 32). Keep it identical on every server. - Default path is FastAPI
ScalekitAuth. Do not hand-rollScalekitClientroutes. Do not copy Express cookies frommanage-saaskit-sessions. - Adapter defaults: GET
/login,/callback,/logout. Cookie issk_session(HttpOnly, SameSite=lax). CSRF cookie issk_oauth_state. - If
SCALEKIT_REDIRECT_URIalready ends in/auth/callback, passcallback_path="/auth/callback"or change both the env and the dashboard to/callback. Keep that URI's host and port. Run the app on that port. Do not keep port 3000 in env and run FastAPI on 5001. userfromrequires_authis access-token claims.subis always present.requires_authrefreshes. Do not add/auth/refresh. Do not return aResponsefrom a protected endpoint — that drops the refreshed cookie.- Register the Initiate Login URL and the Post Logout Redirect URI too.