API Reference
Complete endpoint documentation for the blah.dev OAuth provider.
Base URL: https://blah.dev
Discovery
/.well-known/openid-configurationReturns OAuth 2.0 / OpenID Connect server metadata per RFC 8414.
{
"issuer": "https://blah.dev",
"authorization_endpoint": "https://blah.dev/oauth/authorize",
"token_endpoint": "https://blah.dev/oauth/token",
"userinfo_endpoint": "https://blah.dev/oauth/userinfo",
"revocation_endpoint": "https://blah.dev/oauth/revoke",
"introspection_endpoint": "https://blah.dev/oauth/introspect",
"scopes_supported": ["openid", "email", "profile"],
"response_types_supported": ["code"],
"grant_types_supported": ["authorization_code", "refresh_token"],
"token_endpoint_auth_methods_supported": [
"client_secret_post", "client_secret_basic"
],
"code_challenge_methods_supported": ["plain", "S256"]
}Tokens
/oauth/tokenExchanges an authorization code for tokens, or refreshes an existing token.
Authorization Code Grant
| Parameter | Type | Required | Description |
|---|---|---|---|
grant_type | string | Required | "authorization_code" |
code | string | Required | The authorization code |
redirect_uri | string | Required | Must match the original request |
client_id | string | Required | Your client ID |
client_secret | string | Optional | Required for confidential clients |
code_verifier | string | Optional | Required if PKCE was used |
Response:
{
"access_token": "at_abc123...",
"token_type": "Bearer",
"expires_in": 3600,
"refresh_token": "rt_def456...",
"scope": "openid email"
}Refresh Token Grant
| Parameter | Type | Required | Description |
|---|---|---|---|
grant_type | string | Required | "refresh_token" |
refresh_token | string | Required | The refresh token |
client_id | string | Required | Your client ID |
client_secret | string | Optional | Required for confidential clients |
Note: Refresh tokens are rotated on each use. The old token is revoked when a new one is issued.
User Info
/oauth/userinfoReturns claims about the authenticated user. Requires a valid access token.
Response:
{
"sub": "user_abc123",
"email": "user@example.com"
}Available Claims
| Claim | Scope | Description |
|---|---|---|
sub | openid | Unique user identifier |
email | email or openid | User's email address |
Token Introspection
/oauth/introspectValidates a token and returns metadata. Per RFC 7662. Used by resource servers.
| Parameter | Type | Required | Description |
|---|---|---|---|
token | string | Required | The token to introspect |
token_type_hint | string | Optional | "access_token" or "refresh_token" |
client_id | string | Required | Your client ID |
client_secret | string | Optional | Your client secret |
Active token response:
{
"active": true,
"scope": "openid email",
"client_id": "abc123",
"username": "user@example.com",
"token_type": "Bearer",
"exp": 1704067200,
"iat": 1704063600,
"sub": "user_abc123"
}Inactive token response:
{ "active": false }Token Revocation
/oauth/revokeRevokes an access or refresh token. Per RFC 7009. Always returns 200 OK regardless of whether the token was valid (prevents enumeration).
| Parameter | Type | Required | Description |
|---|---|---|---|
token | string | Required | The token to revoke |
token_type_hint | string | Optional | "access_token" or "refresh_token" |
client_id | string | Required | Your client ID |
client_secret | string | Optional | Your client secret |
Revoking a refresh token also revokes all associated access tokens. Revoking an access token only revokes that specific token.
Client Management
All client management endpoints require authentication via session cookie.
/api/oauth/clientsReturns all OAuth clients owned by the authenticated user.
[
{
"client_id": "client_abc123",
"name": "My App",
"redirect_uris": ["https://myapp.com/callback"],
"created_at": 1704067200000
}
]/api/oauth/clientsCreates a new OAuth client. Returns the client secret (shown only once).
{
"name": "My Application",
"redirect_uris": ["https://myapp.com/callback"]
}Validation
| Field | Rules |
|---|---|
name | 1–100 characters |
redirect_uris | 1–10 valid URLs, HTTPS required (except localhost) |
/api/oauth/clients/{clientId}Returns details for a specific client. Client secret hash is never returned.
/api/oauth/clients/{clientId}Deletes an OAuth client. Only the owner can delete. All tokens for this client become invalid. Cannot be undone.
Error Codes
All errors follow the OAuth 2.0 error format:
{
"error": "error_code",
"error_description": "Human-readable message"
}| Code | Status | Description |
|---|---|---|
invalid_request | 400 | Missing or malformed parameter |
invalid_client | 401 | Client authentication failed |
invalid_grant | 400 | Grant (code/token) invalid or expired |
unauthorized_client | 400 | Client not authorized for grant type |
unsupported_grant_type | 400 | Grant type not supported |
invalid_scope | 400 | Scope invalid or exceeds granted |
access_denied | 403 | User denied authorization |
invalid_token | 401 | Token invalid or expired |
server_error | 500 | Internal server error |