Menu

OAuth provider

Letting another application act for an account: authorization code with PKCE.

OperationMethod and path
Approve an authorization (the consent screen)POST /oauth/authorize
What the consent screen shows of a clientGET /oauth/clients/{id}
The OAuth grants the account holdsGET /oauth/grants
Revoke one OAuth grantPOST /oauth/grants/{id}/revoke
Exchange a code, or rotate a refresh tokenPOST /oauth/token
The account behind an access tokenGET /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.

Credentiala session access token (a signed-in person, not an API key) (x-weird-auth: session)
Chargedno

Request body (OAuthAuthorize):

  • client_id, string, required
  • redirect_uri, string, required
  • scope, string, required — space-separated concrete scopes
  • state, string, required (length 0 to 512)
  • code_challenge, string, required — 43 base64url characters
  • code_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 s
  • expires_at, string, required
  • scope, string, required
  • state, string, required

Refusals ({"error": {"code", "message"}}; see errors):

StatusCodesWhen
400invalid-paramsinvalid-params (with field)
401unauthorizedunauthorized (a signed-in session is required)
403account-suspended, terms-acceptance-requiredaccount-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)
429rate-limitedrate-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.

Credentiala session access token (a signed-in person, not an API key) (x-weird-auth: session)
Chargedno

Parameters

NameInTypeRequiredDescription
idpathstringyes

Answer 200 (OAuthClientView): the result

  • id, string, required
  • name, string, required
  • allowed_scopes, array of strings, required

Refusals ({"error": {"code", "message"}}; see errors):

StatusCodesWhen
401unauthorizedunauthorized
403terms-acceptance-requiredterms-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)
404not-foundnot-found
429rate-limitedrate-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.

Credentialan API key holding the permission below, or a session (x-weird-auth: key)
Permissionoauth:read
Chargedno

Answer 200 (OAuthGrantList): the result

  • grants, array of objects, required
    • id, string, required
    • client_id, string, required
    • client_name, string or null
    • scope, array of strings, required
    • session_id, string or null
    • refreshed_at, string
    • expires_at, string, required

Refusals ({"error": {"code", "message"}}; see errors):

StatusCodesWhen
401unauthorizedunauthorized
403insufficient-scope, terms-acceptance-requiredinsufficient-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)
429rate-limitedrate-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 list

MCP: 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.

Credentialan API key holding the permission below, or a session (x-weird-auth: key)
Permissionoauth:write
Chargedno

Parameters

NameInTypeRequiredDescription
idpathstringyes

Answer 200 (Ok): the result

  • ok, boolean, required (must be true)

Refusals ({"error": {"code", "message"}}; see errors):

StatusCodesWhen
401unauthorizedunauthorized
403insufficient-scope, terms-acceptance-requiredinsufficient-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)
404not-foundnot-found (not the caller's, already revoked)
429rate-limitedrate-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.

Credentialnone: anyone may call it (x-weird-auth: public)
Chargedno

Request body (OAuthTokenRequest):

  • grant_type, string, required (one of authorization_code, refresh_token)
  • client_id, string, required
  • client_secret, string (password), required (a secret: shown once, never logged)
  • code, string — authorization_code
  • redirect_uri, string — authorization_code: the authorization's
  • code_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, valid expires_in seconds (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, required
  • scope, string, required

Refusals ({"error": {"code", "message"}}; see errors):

StatusCodesWhen
400invalid-grant, invalid-paramsinvalid-params (another grant type) or invalid-grant
401invalid-clientinvalid-client
429rate-limitedrate-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.

Credentialan OAuth access token (x-weird-auth: oauth)
Permissionprofile:read
Chargedno

Answer 200 (Userinfo): the result

  • sub, string, required
  • email, string, required
  • name, string or null, required
  • scope, string, required

Refusals ({"error": {"code", "message"}}; see errors):

StatusCodesWhen
401unauthorizedunauthorized
403insufficient-scope, terms-acceptance-requiredinsufficient-scope (required, granted) or terms-acceptance-required (required)
429rate-limitedrate-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.