Menu
OAuth provider
Letting another application act for an account: authorization code with PKCE.
| Operation | Method and path |
|---|---|
| Approve an authorization (the consent screen) | POST /oauth/authorize |
| What the consent screen shows of a client | GET /oauth/clients/{id} |
| The OAuth grants the account holds | GET /oauth/grants |
| Revoke one OAuth grant | POST /oauth/grants/{id}/revoke |
| Exchange a code, or rotate a refresh token | POST /oauth/token |
| The account behind an access token | GET /oauth/userinfo |
Approve an authorization (the consent screen)#
POST /oauth/authorize · operation oauthAuthorize
Called by the consent screen for the signed-in person. PKCE with S256 is required. Every parameter must match the client's registration: a mismatch is 400 invalid-params naming the field (never a redirect). Answers a single-use authorization code, valid 120 seconds, for that client, redirect URI, scopes and challenge. The access it leads to is ended with POST /oauth/grants/{id}/revoke. This call is not charged.
| Credential | a session access token (a signed-in person, not an API key) (x-weird-auth: session) |
| Charged | no |
Request body (OAuthAuthorize):
client_id, string, requiredredirect_uri, string, requiredscope, string, required — space-separated concrete scopesstate, string, required (length 0 to 512)code_challenge, string, required — 43 base64url characterscode_challenge_method, string, required (must be"S256")
Answer 200 (OAuthAuthorization): the result
redirect, string, required —<redirect_uri>?code=<code>&state=<state>code, string, required — single use, 120 sexpires_at, string, requiredscope, string, requiredstate, string, required
Refusals ({"error": {"code", "message"}}; see errors):
| Status | Codes | When |
|---|---|---|
| 400 | invalid-params | invalid-params (with field) |
| 401 | unauthorized | unauthorized (a signed-in session is required) |
| 403 | account-suspended, terms-acceptance-required | account-suspended (the account is restricted while a report about it is reviewed: reading, support tickets and the copy of its data keep working; contact is the address to write to, GET /auth/account/restrictions says more); terms-acceptance-required (the current terms of service or privacy notice are not accepted yet: required lists them; read them with GET /legal/documents and accept with POST /auth/legal/accept) |
| 429 | rate-limited | rate-limited |
Example
curl -X POST 'https://api.weird.ro/oauth/authorize' \
-H "Authorization: Bearer $WEIRD_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{"client_id":"<client_id>","redirect_uri":"<redirect_uri>","scope":"<scope>","state":"<state>","code_challenge":"<code_challenge>","code_challenge_method":"S256"}'What the consent screen shows of a client#
GET /oauth/clients/{id} · operation oauthClient
The registered client id (an application asking the account for access): its name and the scopes it may ask for, for the consent screen; the person then authorizes it with POST /oauth/authorize or refuses. Changes nothing. This call is not charged.
| Credential | a session access token (a signed-in person, not an API key) (x-weird-auth: session) |
| Charged | no |
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
id | path | string | yes |
Answer 200 (OAuthClientView): the result
id, string, requiredname, string, requiredallowed_scopes, array of strings, required
Refusals ({"error": {"code", "message"}}; see errors):
| Status | Codes | When |
|---|---|---|
| 401 | unauthorized | unauthorized |
| 403 | terms-acceptance-required | terms-acceptance-required (the current terms of service or privacy notice are not accepted yet: required lists them; read them with GET /legal/documents and accept with POST /auth/legal/accept) |
| 404 | not-found | not-found |
| 429 | rate-limited | rate-limited |
Example
curl -X GET 'https://api.weird.ro/oauth/clients/{id}' \
-H "Authorization: Bearer $WEIRD_ACCESS_TOKEN"The OAuth grants the account holds#
GET /oauth/grants · operation listOAuthGrants
One entry per client the account authorized that can still obtain tokens, newest first; id is what the revocation takes. This call is not charged.
| Credential | an API key holding the permission below, or a session (x-weird-auth: key) |
| Permission | oauth:read |
| Charged | no |
Answer 200 (OAuthGrantList): the result
grants, array of objects, requiredid, string, requiredclient_id, string, requiredclient_name, string or nullscope, array of strings, requiredsession_id, string or nullrefreshed_at, stringexpires_at, string, required
Refusals ({"error": {"code", "message"}}; see errors):
| Status | Codes | When |
|---|---|---|
| 401 | unauthorized | unauthorized |
| 403 | insufficient-scope, terms-acceptance-required | insufficient-scope (an API key without the route's scope: required, granted); terms-acceptance-required (the current terms of service or privacy notice are not accepted yet: required lists them; read them with GET /legal/documents and accept with POST /auth/legal/accept) |
| 429 | rate-limited | rate-limited |
Example
curl -X GET 'https://api.weird.ro/oauth/grants' \
-H "Authorization: Bearer $WEIRD_API_KEY"With the CLI (weird oauth list):
$ weird oauth listMCP: weird_oauth_apps.
Revoke one OAuth grant#
POST /oauth/grants/{id}/revoke · operation revokeOAuthGrant
The client's tokens of this grant stop working at once. This call is not charged.
| Credential | an API key holding the permission below, or a session (x-weird-auth: key) |
| Permission | oauth:write |
| Charged | no |
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
id | path | string | yes |
Answer 200 (Ok): the result
ok, boolean, required (must betrue)
Refusals ({"error": {"code", "message"}}; see errors):
| Status | Codes | When |
|---|---|---|
| 401 | unauthorized | unauthorized |
| 403 | insufficient-scope, terms-acceptance-required | insufficient-scope (an API key without the route's scope: required, granted); terms-acceptance-required (the current terms of service or privacy notice are not accepted yet: required lists them; read them with GET /legal/documents and accept with POST /auth/legal/accept) |
| 404 | not-found | not-found (not the caller's, already revoked) |
| 429 | rate-limited | rate-limited |
Example
curl -X POST 'https://api.weird.ro/oauth/grants/{id}/revoke' \
-H "Authorization: Bearer $WEIRD_API_KEY"With the CLI (weird oauth revoke):
$ weird oauth revoke <id>MCP: weird_oauth_app_revoke.
Exchange a code, or rotate a refresh token#
POST /oauth/token · operation oauthToken
The client's id and secret in the body. authorization_code exchanges the code (with the same redirect URI and the PKCE code_verifier); refresh_token exchanges a refresh token for new tokens: each refresh token is used once, keep the new one. Reusing a code or a refresh token ends the whole authorization: the person must authorize the client again. This call is not charged.
| Credential | none: anyone may call it (x-weird-auth: public) |
| Charged | no |
Request body (OAuthTokenRequest):
grant_type, string, required (one ofauthorization_code,refresh_token)client_id, string, requiredclient_secret, string (password), required (a secret: shown once, never logged)code, string — authorization_coderedirect_uri, string — authorization_code: the authorization'scode_verifier, string (password) — authorization_code (length 43 to 128; a secret: shown once, never logged)refresh_token, string (password) — refresh_token (a secret: shown once, never logged)
Answer 200 (OAuthTokens): the result
access_token, string (password), required — the access token, validexpires_inseconds (a secret: shown once, never logged)refresh_token, string (password), required — opaque, rotated on every refresh (a secret: shown once, never logged)token_type, string, required (must be"Bearer")expires_in, integer, requiredscope, string, required
Refusals ({"error": {"code", "message"}}; see errors):
| Status | Codes | When |
|---|---|---|
| 400 | invalid-grant, invalid-params | invalid-params (another grant type) or invalid-grant |
| 401 | invalid-client | invalid-client |
| 429 | rate-limited | rate-limited |
Example
curl -X POST 'https://api.weird.ro/oauth/token' \
-H "Content-Type: application/json" \
-d '{"grant_type":"authorization_code","client_id":"<client_id>","client_secret":"<client_secret>"}'The account behind an access token#
GET /oauth/userinfo · operation oauthUserinfo
A bearer OAuth access token holding profile:read; a session token or an API key is not accepted here. A refusal carries a WWW-Authenticate: Bearer header with error="invalid_token". Refused 403 terms-acceptance-required (required) while the account has not accepted the current terms of service and privacy notice: the person accepts them in the web app, then the token works again. This call is not charged.
| Credential | an OAuth access token (x-weird-auth: oauth) |
| Permission | profile:read |
| Charged | no |
Answer 200 (Userinfo): the result
sub, string, requiredemail, string, requiredname, string or null, requiredscope, string, required
Refusals ({"error": {"code", "message"}}; see errors):
| Status | Codes | When |
|---|---|---|
| 401 | unauthorized | unauthorized |
| 403 | insufficient-scope, terms-acceptance-required | insufficient-scope (required, granted) or terms-acceptance-required (required) |
| 429 | rate-limited | rate-limited |
Example
curl -X GET 'https://api.weird.ro/oauth/userinfo' \
-H "Authorization: Bearer $OAUTH_ACCESS_TOKEN"This page is generated from the API's public document; it changes when the document does.