Sign in with Disfora uses standard OAuth 2.0 (authorization code + PKCE). Users sign in on Disfora, approve the scopes you ask for, and your app learns who they are: a stable user id, their username, name and avatar, and, if they allow it, their email, age, date of birth, gender and bio.
Apps can't post, rate or read notifications on users' behalf yet.
Quickstart
- Sign in here and create an app: name, redirect URIs, and the scopes it may ask for.
- Send users to
/oauth/authorize. They come back to your redirect URI with acode. - Exchange the code at
/oauth/tokenfor an access token (15 min) and a refresh token (30 days). - Read the user's profile from the token response, or later from
/oauth/userinfowithAuthorization: Bearer ….
Scopes
Your app may only ask for scopes ticked in its settings. profile is always included.
| Scope | What the user sees |
|---|---|
profile | See your username, name and profile picture |
email | See your email address |
age | See your age (not your date of birth) |
birthdate | See your date of birth |
gender | See your gender |
bio | See your bio |
2. Exchange the code (within 5 minutes, once)
POST https://disfora.com/oauth/token Content-Type: application/x-www-form-urlencoded (JSON works too) grant_type=authorization_code &code=CODE &redirect_uri=https://example.com/auth/disfora/callback &client_id=YOUR_CLIENT_ID &client_secret=YOUR_CLIENT_SECRET (server apps; or HTTP Basic) &code_verifier=VERIFIER
{
"access_token": "dfa_…", "token_type": "bearer", "expires_in": 900,
"refresh_token": "dfr_…", "refresh_token_expires_in": 2592000, "scope": "profile email",
"user": {
"sub": "stable id for this user in your app",
"username": "…", "first_name": "…", "last_name": "…",
"avatar_url": "…", "profile_url": "https://disfora.com/u/…",
"email": "…", "email_verified": true (only with the email scope)
"age": 27 | null (only with the age scope: whole years. Ask for this one
if your app only needs to know someone's age)
"birthdate": "1998-04-23" | null (only with the birthdate scope)
"gender": "male" | "female" | "other" | "prefer_not_to_say" | null (only with the gender scope)
"bio": "…" | null (only with the bio scope)
}
}
Key your users on sub: it never changes for your app and is different in every app. Server apps keep tokens and the client secret on the server.
3. Fetch the user's profile again
GET https://disfora.com/oauth/userinfo Authorization: Bearer ACCESS_TOKEN
Returns the same user object as the token response, limited to the scopes the user still allows. This is the only endpoint app tokens work on; every other Disfora endpoint answers 401.
4. Refresh, and revoke on sign-out
POST https://disfora.com/oauth/token grant_type=refresh_token&refresh_token=dfr_…&client_id=…&client_secret=… POST https://disfora.com/oauth/revoke token=dfr_…&client_id=…&client_secret=… (always 200)
Every refresh returns a new refresh token: store it and drop the old one. Reusing a spent refresh token revokes all of that user's tokens for your app.
Rules
- Server apps exchange codes and refresh tokens on their server with the client secret. Browser apps (no backend) and mobile apps have no secret and must use PKCE; leave
client_secretout. - Browser apps call
/oauth/token,/oauth/revokeand/oauth/userinfostraight from JavaScript (CORS), only from the JavaScript origins registered on the app and without cookies. Keep the access token in memory. To survive a page reload, keep only the refresh token, insessionStorage(it rotates on every use and a replay revokes it); neverlocalStorage. - Mobile apps open
/oauth/authorizein the system browser (ASWebAuthenticationSession, Custom Tabs), never an embedded web view, and come back on a universal/app link or a custom scheme named after a domain you own (com.example.app:/callback). - Access tokens last 15 minutes. Refresh tokens last 30 days: server and mobile apps get a fresh 30 days on each refresh; browser apps keep the expiry of the first sign-in, so their users sign in again after 30 days.
refresh_token_expires_inin every token response says how long is left. - Codes are single use, valid 5 minutes, and bound to your client, redirect URI and PKCE verifier.
- Up to 600 requests a minute per app.
- Users can disconnect your app from their profile; deleting your app revokes everything. Both take effect immediately.
- We may suspend an app that breaks the developer terms. While suspended, sign-in and its tokens stop working.
- Removing a scope from your app removes it from every existing token too.
Errors
Bodies are {"detail": "…"}.
- 400 on authorize: unknown or suspended client, unregistered redirect URI, bad state, or a scope your app isn't registered for.
- 401 on token/revoke: wrong or missing client secret.
- 400
Invalid or expired refresh token: spent, expired or revoked. - 401 on
/oauth/userinfo: expired or revoked token, or a suspended app. - 429: your app's rate limit. Wait for
Retry-After.