Set up Sign in with GitHub
About 5 minutes. You create a GitHub OAuth app, give Klio its Client ID and secret, and the Continue with GitHub button appears on the sign-in page.
1Create a GitHub OAuth app
- Open github.com/settings/developers → OAuth Apps → New OAuth App. (For an organization: the org's Settings → Developer settings → OAuth Apps.)
- Fill in the form. GitHub allows one callback URL per app, so make one app for local development and one for production.The callback must match exactly:Application name
Klio (local)orKlioHomepage URLhttps://klio.devAuthorization callback URLhttps://klio.dev/api/auth/github/callbackEnable Device FlowLeave offhttpvshttps, the port, andlocalhostvs127.0.0.1all count.https://klio.dev/api/auth/github/callback - Click Register application. Copy the Client ID, then Generate a new client secret and copy it right away. GitHub shows the secret only once.
2Local development
Add both values to .dev.vars in the Klio folder. That file is git-ignored; never commit it.
GITHUB_CLIENT_ID=paste-the-client-id
GITHUB_CLIENT_SECRET=paste-the-client-secretRestart the dev server (Ctrl+C, then npm run dev). It reads .dev.vars only at startup. Use the callback http://localhost:3000/api/auth/github/callback if you run on the default port.
3Production (Cloudflare Workers)
Create a second OAuth app whose callback is https://klio.dev/api/auth/github/callback, then store its values as Worker secrets from the Klio folder. Each command prompts for the value, so it never lands in your shell history:
npx wrangler secret put GITHUB_CLIENT_ID
npx wrangler secret put GITHUB_CLIENT_SECRETAlso make sure:
APP_URLinwrangler.jsonc→varsis your production URL (https://klio.dev). Klio builds the callback from it. Redeploy withnpm run deployif you change it.- The other server secrets are set once:
openssl rand -hex 32 | npx wrangler secret put SESSION_SECRETand the same forENCRYPTION_KEY.
Secrets take effect on the next request; no redeploy needed for them.
4Check it works
- Open /login. You should see Continue with GitHub.
- Sign in. GitHub asks you to authorize the app once, then you land in Klio. Your first sign-in creates a workspace with a short tour project.
Klio asks GitHub only for read:user and user:email: your name, avatar and verified email. It gets no access to your repositories.
Troubleshooting
“GitHub sign-in isn't set up on this server yet”
GITHUB_CLIENT_ID isn't set where Klio runs. Locally, check .dev.vars and restart npm run dev. In production, run npx wrangler secret list and add it with npx wrangler secret put GITHUB_CLIENT_ID.
GitHub says “The redirect_uri is not associated with this application”
The callback URL in your OAuth app doesn't match where Klio is running. It must be exactly https://klio.dev/api/auth/github/callback for this server. Edit it under the OAuth app's settings, or use the app made for this environment.
“That sign-in attempt expired. Try again.”
The sign-in took longer than 10 minutes, or you started on one address and came back on another (for example 127.0.0.1 vs localhost). Start again from the same address as APP_URL.
“GitHub didn't accept the sign-in.”
The Client ID and secret don't belong together. This usually means the secret was regenerated or mistyped, or the ID is from the other environment's app. Generate a new client secret and set both values again.
“Your GitHub account has no verified email.”
Add and verify an email at github.com/settings/emails, or sign in with an email link instead.
“You cancelled the GitHub sign-in.”
You clicked Cancel on GitHub's authorization screen. Click Continue with GitHub again and choose Authorize.
Optional: move stories from pull requests
Sign-in and PR sync are separate. To have PRs and commits that mention a story ID (like KLIO-12) move it on the board, add a webhook to each repo: Settings → Webhooks → Add webhook.
https://klio.dev/api/github/webhook?token=klio_… (a token from Settings → Connect agents)application/jsonnpx wrangler secret put GITHUB_WEBHOOK_SECRET.