This sample runs as a Node web service with an HTML UI and a secure GitHub connection flow. Each browser session connects its own GitHub account once, then reuses that connected token for later PR summary requests.
Scalekit provides the GitHub connector, connected-account vault, and user verification flow. Render provides the hosting surface for the Express app and its task execution.
The browser never sends a userId.
Instead, the server:
- mints a random opaque identifier for each session
- stores that identifier in a server-side session record
- sends only a signed, HTTP-only cookie to the browser
- validates a one-time
stateduring the OAuth callback - calls
verifyConnectedAccountUserbefore using the connected token
That prevents one browser session from pointing requests at another user's connected GitHub credentials.
Browser
│
▼ GET /
Express app on Render
│ set signed HTTP-only session cookie
▼ POST /api/auth
Scalekit creates auth link for session-bound identifier
│
▼ GET /user/verify
Express app validates state and calls verifyConnectedAccountUser
│
▼ POST /api/summarize { owner, repo }
Scalekit GitHub connector fetches PR data with the connected user's token
PORTLITELLM_API_KEYLITELLM_BASE_URLLITELLM_MODELSCALEKIT_ENVIRONMENT_URLSCALEKIT_CLIENT_IDSCALEKIT_CLIENT_SECRETGITHUB_CONNECTION_NAMESESSION_SECRETPUBLIC_BASE_URL
Generate SESSION_SECRET with openssl rand -hex 32.
Set PUBLIC_BASE_URL to the public origin of the deployed service, for example https://your-service.onrender.com.
If you deploy from the included render.yaml, Render auto-generates SESSION_SECRET. You still need to supply PUBLIC_BASE_URL.
Before using the deployed app:
- Create a GitHub connector in Agent Auth > Connectors
- In the Scalekit Dashboard, go to AgentKit > Settings > User verification and set it to Custom user verification
- Set
PUBLIC_BASE_URLto the exact origin where the app will run - The app sends
${PUBLIC_BASE_URL}/user/verifyasuserVerifyUrlwhen it creates the GitHub auth link
GET /: HTML UI with Connect GitHub and repository summary formPOST /api/auth: starts the GitHub OAuth flow for the current sessionGET /user/verify: completes connected-account verification after OAuthPOST /api/summarize: summarizes PRs for the repository using the session's connected GitHub account
The sample stores session data in memory. That is acceptable for a single-instance demo. Use a shared store such as Redis or a database-backed session store in production.