Commit e6ec716
authored
feat(auth): add Discord as auth provider with guild membership verification (#1354)
## Summary
- Add Discord as an OAuth auth provider on the user profile page, using
a separate Discord OAuth app (distinct from the existing bot)
- Add Discord guild membership verification — checks if the user is a
member of the Kilo Discord server via the bot API
- Auto-verify guild membership when a user first links their Discord
account; re-verify button available for non-members
- New DB migration adds `discord_server_member` and
`discord_server_member_at` columns to `kilocode_users`
## Verification
- [x] `pnpm typecheck` — passes
- [x] `pnpm test` — passes
- [x] Link Discord account on profile page
- [x] Guild membership auto-verifies after linking
- [x] Re-verify button works for non-members
- [x] Soft delete nullifies new Discord columns
## Visual Changes
New "Discord Server Membership" card on the user profile page showing:
- Prompt to link Discord if not connected
- Green checkmark with verification date if user is a Kilo Discord
member
- "Not a member" status with invite link and re-verify button otherwise
## Loom (Kilo Team only)
https://www.loom.com/share/3512eb86ef38454d86c95fa7cbfc51f1
## Other PRs for this feature
#1356
## Reviewer Notes
- Discord OAuth app env vars (`DISCORD_OAUTH_CLIENT_ID`,
`DISCORD_OAUTH_CLIENT_SECRET`) are separate from the existing bot token
(`DISCORD_OAUTH_BOT_TOKEN`) — the bot token is used server-side for
guild membership checks
- `discord_provider_account_id` was intentionally excluded from the
`getDiscordGuildStatus` response to minimize API surface
- Guild check errors are caught and sanitized to avoid leaking internal
details (rate limits, missing env vars) to the client21 files changed
Lines changed: 1351 additions & 1011 deletions
File tree
- packages/db/src
- migrations
- meta
- src
- app/api/cloud-agent/sessions/prepare
- components
- auth
- profile
- lib
- auth
- integrations
- routers
- tests
- helpers
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
0 commit comments