Access Grant
An Access Grant represents an authorization code issued during the Authorization Code flow. It is a short-lived, one-time-use credential that a client exchanges for an access token at the token endpoint. In Doorkeeper, access grants are stored in the oauth_access_grants table and modeled by Doorkeeper::AccessGrant.
Key attributes
token
The authorization code string sent to the client via the redirect URI.
resource_owner_id
The ID of the user who authorized the application.
application_id
The OAuth application (client) that requested authorization.
redirect_uri
The redirect URI used for this specific authorization request (must match one registered on the application).
expires_in
Time-to-live in seconds. Default is 600 (10 minutes), configurable via authorization_code_expires_in.
scopes
The scopes granted by the resource owner for this authorization.
revoked_at
Timestamp when the grant was revoked (if applicable).
PKCE fields
When PKCE is enabled, two additional columns store the code challenge:
code_challenge
The code challenge value sent during the authorization request.
code_challenge_method
The transformation method used (plain or S256).
Lifecycle
The resource owner approves an authorization request at
/oauth/authorize.Doorkeeper creates an
AccessGrantrecord with a generatedtoken(the authorization code).The client is redirected to its
redirect_uriwith the code as a query parameter.The client exchanges the code at
POST /oauth/tokenwithgrant_type=authorization_code.Doorkeeper verifies the code, revokes the grant, and issues an Access Token.
Authorization codes are one-time use — once exchanged for a token, the grant is revoked and cannot be reused.
Configuration
See also
Database Design — schema details for
oauth_access_grantsGrant Flows — the Authorization Code flow explained
PKCE Flow — securing the code exchange for public clients
Last updated