API Reference

oauth2

10 endpoints

GET/oauth2/authorize

Authorize

OAuth2 Authorization Endpoint.

Initiates the authorization code flow. If the user is authenticated and has granted consent (or client is first-party), redirects with an authorization code. Otherwise, returns information for consent UI.

Query parameters

response_type*string

max length 32

client_id*string

max length 64

redirect_uri*string

max length 2048

scopestring | null
statestring | null
code_challengestring | null
code_challenge_methodstring | null
noncestring | null

Responses

200Successful Response

any

422Validation Error
FieldTypeDescription
detailValidationError[]

array items · ValidationError

FieldTypeDescription
loc*string | integer[]
msg*string
type*string

Example request

curl -X GET "https://api.davi.social/oauth2/authorize" \
  -H "Authorization: Bearer <token>"
POST/oauth2/authorize/consent

Authorize Consent

Handle consent form submission.

Called by frontend after user approves or denies consent.

Responses

200Successful Response

any

422Validation Error
FieldTypeDescription
detailValidationError[]

array items · ValidationError

FieldTypeDescription
loc*string | integer[]
msg*string
type*string

Example request

curl -X POST "https://api.davi.social/oauth2/authorize/consent" \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{ /* request body */ }'
POST/oauth2/token

Token

OAuth2 Token Endpoint.

Supports:

  • authorization_code: Exchange code for tokens
  • refresh_token: Refresh access token

Header parameters

authorizationstring | null

Responses

200Successful Response
FieldTypeDescription
access_token*string
token_typestring

default: "Bearer"

expires_in*integer

Token lifetime in seconds

refresh_tokenstring | null
scopestring | null

Space-separated granted scopes

id_tokenstring | null

OIDC ID token (when openid scope granted)

issued_token_typestring | null

RFC 8693: Type of token issued (for token exchange responses)

422Validation Error
FieldTypeDescription
detailValidationError[]

array items · ValidationError

FieldTypeDescription
loc*string | integer[]
msg*string
type*string

Example request

curl -X POST "https://api.davi.social/oauth2/token" \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{ /* request body */ }'
POST/oauth2/introspect

Introspect

Token Introspection Endpoint (RFC 7662).

Allows clients (typically resource servers) to validate tokens.

Header parameters

authorizationstring | null

Responses

200Successful Response
FieldTypeDescription
active*boolean

Whether the token is active

scopestring | null
client_idstring | null
usernamestring | null
token_typestring | null
expinteger | null

Expiration timestamp

iatinteger | null

Issued at timestamp

nbfinteger | null

Not before timestamp

substring | null

Subject (user identifier)

audstring | null

Audience

issstring | null

Issuer

jtistring | null

JWT ID

422Validation Error
FieldTypeDescription
detailValidationError[]

array items · ValidationError

FieldTypeDescription
loc*string | integer[]
msg*string
type*string

Example request

curl -X POST "https://api.davi.social/oauth2/introspect" \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{ /* request body */ }'
POST/oauth2/revoke

Revoke

Token Revocation Endpoint (RFC 7009).

Revokes an access or refresh token.

Header parameters

authorizationstring | null

Responses

200Successful Response

any

422Validation Error
FieldTypeDescription
detailValidationError[]

array items · ValidationError

FieldTypeDescription
loc*string | integer[]
msg*string
type*string

Example request

curl -X POST "https://api.davi.social/oauth2/revoke" \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{ /* request body */ }'
GET/oauth2/.well-known/jwks.json

Jwks

JSON Web Key Set endpoint.

Returns the public keys used to verify ID tokens and other JWTs.

Responses

200Successful Response

any

Example request

curl -X GET "https://api.davi.social/oauth2/.well-known/jwks.json" \
  -H "Authorization: Bearer <token>"
GET/oauth2/.well-known/openid-configuration

Openid Configuration

OpenID Connect Discovery document.

Returns the OAuth2/OIDC server configuration.

Every URL here is built from the configured issuer, never from the path the request arrived on. The router is reachable at more than one prefix — the canonical /oauth2 mount plus two deprecated aliases — and OIDC requires the discovery issuer to equal the iss claim of an id_token exactly. A path-derived issuer makes that impossible: it says something different depending on which prefix a client happened to use, and at most one of those can match what the tokens actually carry.

Responses

200Successful Response
FieldTypeDescription
issuer*string
authorization_endpoint*string
token_endpoint*string
userinfo_endpointstring | null
revocation_endpointstring | null
introspection_endpointstring | null
jwks_uristring | null
response_types_supported*string[]
grant_types_supported*string[]
code_challenge_methods_supported*string[]
token_endpoint_auth_methods_supported*string[]
scopes_supported*string[]
claims_supportedstring[] | null
subject_types_supportedstring[] | null
id_token_signing_alg_values_supportedstring[] | null

Example request

curl -X GET "https://api.davi.social/oauth2/.well-known/openid-configuration" \
  -H "Authorization: Bearer <token>"
GET/oauth2/userinfo

Oauth2 Userinfo

OIDC UserInfo endpoint.

Returns user information based on granted scopes.

Deliberately not registered on this router: UserInfo is an OIDC endpoint and belongs on the OAuth2 mount, next to the discovery document that advertises it. router_oauth2 registers this same function at /oauth2/userinfo. Defined here because it is auth-user identity, and to keep the OAuth2 router free of a second get_current_auth_context import cycle.

Responses

200Successful Response
FieldTypeDescription
sub*string
emailstring | null
email_verifiedboolean | null

Example request

curl -X GET "https://api.davi.social/oauth2/userinfo" \
  -H "Authorization: Bearer <token>"
GET/oauth2/scopes

Get Scope Metadata

Get grouped scope metadata for consent screen.

Groups scopes by category and provides appropriate consent descriptions based on the level of access requested. Scopes with requires_ownership=True are flagged as requiring resource-level access (vs personal resources).

Query parameters

scopes*string

Space-separated list of scope names

Responses

200Successful Response
FieldTypeDescription
groups*ScopeGroup[]

Scopes grouped by category with combined descriptions

array items · ScopeGroup

FieldTypeDescription
consent_description*string

User-friendly description for consent screen

scopes*string[]

List of scope identifiers in this group

sensitiveboolean

True if any scope in the group is sensitive

default: false

category*string

Scope category

requires_resource_accessboolean

True if scopes apply to resources user has access to, not personal resources

default: false

422Validation Error
FieldTypeDescription
detailValidationError[]

array items · ValidationError

FieldTypeDescription
loc*string | integer[]
msg*string
type*string

Example request

curl -X GET "https://api.davi.social/oauth2/scopes" \
  -H "Authorization: Bearer <token>"
GET/oauth2/client-info

Get Client Info

Get OAuth app details for consent pages and login banners.

Unauthenticated endpoint. Returns app info with icon (fallback to org logo), organization details, and optionally scope groups.

Query parameters

client_id*string

OAuth2 client_id

with_scopesboolean

default: false

scopesstring | null

Responses

200Successful Response
FieldTypeDescription
client*ClientInfo

object · ClientInfo

FieldTypeDescription
client_id*string
client_name*string
client_descriptionstring | null
icon_urlstring | null
client_uristring | null
organization*OrganizationInfo

object · OrganizationInfo

FieldTypeDescription
name*string
descriptionstring | null
logo_urlstring | null
websitestring | null
scope_groupsScopeGroup[] | null

array items · ScopeGroup

FieldTypeDescription
consent_description*string

User-friendly description for consent screen

scopes*string[]

List of scope identifiers in this group

sensitiveboolean

True if any scope in the group is sensitive

default: false

category*string

Scope category

requires_resource_accessboolean

True if scopes apply to resources user has access to, not personal resources

default: false

422Validation Error
FieldTypeDescription
detailValidationError[]

array items · ValidationError

FieldTypeDescription
loc*string | integer[]
msg*string
type*string

Example request

curl -X GET "https://api.davi.social/oauth2/client-info" \
  -H "Authorization: Bearer <token>"