Databases

OAuth 2.0 Token & Scope Data Model

ER Diagrams · made in Skemio

ER diagram of an OAuth 2.0 database showing client applications, authorization grants, access tokens, scopes, and token scope associations.
ER diagram of an OAuth 2.0 database showing client applications, authorization grants, access tokens, scopes, and token scope associations.

What it shows

  • Store token hashes rather than plaintext to limit token exposure risks.
  • Normalize scopes in a junction table to inspect granular permissions.
  • Link refresh tokens directly to root authorization grants for cascading revokes.

The takeaway

Decouple access tokens from scopes using junction tables to enable granular and instant revocations.

More er diagrams