Skip to content
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

ColumnTypeNullDefaultKeys
code_hashtext no—
PK
grant_iduuid no—
client_idtext no—
redirect_uritext no—
code_challengetext no—
resourcetext no—
scopesjsonb no[]
expires_attimestamp no—
used_attimestamp yes—
created_attimestamp nonow()

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

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.