Commit 952b0aa
Add OAuth team selection for multi-team accounts (MCP)
Multi-team accounts connecting an OAuth/MCP client (e.g. Claude) had no
way to specify a team: the only mechanism was the X-Sendlit-Team-Id
header, which generic OAuth clients never send, so every /mcp call hit
require-team.ts's 409 team_required response right after authorizing.
Adds a "select a team" step to the OAuth flow via oauth-provider's
postLogin hook, shown only for multi-team accounts (mirrors Notion's
workspace picker) — the choice is threaded through as the OAuth
referenceId and lands on the minted access token as a team_id claim,
which resolve-auth.ts now re-validates as live membership before
trusting. Single-team accounts are unaffected.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>1 parent ec1bbaa commit 952b0aa
12 files changed
Lines changed: 5537 additions & 29 deletions
File tree
- apps
- api
- drizzle
- meta
- src
- auth
- db
- team
- docs/content/docs/developers
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
0 commit comments