oauth_access_tokens table
The oauth_access_tokens table in the Reddit Clone Database Schema schema has 9 columns, keyed by id, with 2 foreign keys to oauth_applications and users.
user_id null is an application-only token with no human behind it, which is exactly the case rate limiting has to treat differently.
Columns (9)
| Column | Type | Constraints | Description |
|---|---|---|---|
| id | uuid | primary key | |
| application_id | uuid | not null, references oauth_applications.id | |
| user_id | uuid | references users.id | |
| token_hash | varchar(255) | unique, not null | |
| refresh_token_hash | varchar(255) | ||
| scopes | varchar(500) | not null | |
| issued_at | timestamptz | not null | |
| expires_at | timestamptz | not null | |
| revoked_at | timestamptz |
Indexes (2)
(application_id, user_id)(user_id, revoked_at)
Relationships
oauth_access_tokens.application_idreferencesoauth_applications.idoauth_access_tokens.user_idreferencesusers.id