Identity & auth
oauth_codes
Authorization codes: single use, a few minutes, bound to the PKCE challenge, the exact redirect_uri and the resource (RFC 8707) they were issued for.
Columns
| Column | Type | Null | Default | Keys |
|---|---|---|---|---|
| code_hash | text | no | — | PK |
| grant_id | uuid | no | — | |
| client_id | text | no | — | |
| redirect_uri | text | no | — | |
| code_challenge | text | no | — | |
| resource | text | no | — | |
| scopes | jsonb | no | [] | |
| expires_at | timestamp | no | — | |
| used_at | timestamp | yes | — | |
| created_at | timestamp | no | now() |
Value lists come from .$type<'a' | 'b'>() in the schema — enforced in TypeScript only, not by the database.
Keys, constraints & indexes
Unique
None besides the primary key.
Indexes
No secondary indexes.
Foreign keys
- grant_id → oauth_grants.id on delete cascade
Used by
Code that reads or writes this table, found by static analysis of the tRPC routers and API handlers (including helpers they call).
tRPC procedures
REST & webhooks
- ANY /mcp
- ANY /mcp/public
- ANY /oauth/token
Relations
Rendering diagram…
Diagram source
erDiagram
oauth_codes {
text code_hash PK
uuid grant_id FK
}
oauth_grants {
uuid id PK
uuid dancer_id FK
text client_id FK
}
oauth_grants ||--o{ oauth_codes : "grant_id" Defined at server/database/schema.ts:1371 as oauthCodes.