Developers

Integrate Failure AI OAuth

Failure is a PKCE OAuth 2.0 authorization server. Register an app in the dashboard, show the frosted glass Sign in with Failure button, and exchange the code for tokens that unlock linked providers. Full integration guide: docs/INTEGRATION.md.

PKCE quickstart

  1. Create a public client in the dashboard (PKCE required).
  2. Send users to /oauth/authorize with code_challenge (S256).
  3. Exchange the code at /api/oauth/token with code_verifier.
  4. Call /api/oauth/userinfo with the access token to read profile + provider credentials.

Discovery

https://oauth.failure.fail/.well-known/openid-configuration

Universal UI format

{ "brand": "Failure", "product": "Failure AI OAuth", "button": { "id": "sign-in-with-failure", "label": "Sign in with Failure", "recommendedHeight": 48, "recommendedMinWidth": 260, "theme": { "surface": "frosted-glass", "background": "linear-gradient(135deg, rgba(255,255,255,0.18), rgba(255,255,255,0.05))", "border": "1px solid rgba(255,255,255,0.28)", "blur": "18px", "text": "#fff7ed", "accent": "#ff6b35", "shadow": "0 10px 40px rgba(0,0,0,0.35)", "radius": "999px", "fontFamily": "\"Syne\", \"Figtree\", sans-serif" }, "cssClass": "failure-signin-btn", "scriptUrl": "https://oauth.failure.fail/sdk/sign-in-with-failure.js", "cssUrl": "https://oauth.failure.fail/sdk/sign-in-with-failure.css" }, "oauth": { "authorize": "https://oauth.failure.fail/oauth/authorize", "token": "https://oauth.failure.fail/api/oauth/token", "userinfo": "https://oauth.failure.fail/api/oauth/userinfo", "discovery": "https://oauth.failure.fail/.well-known/openid-configuration", "pkceRequired": true, "responseType": "code", "defaultScopes": [ "openid", "profile", "email", "providers", "offline_access" ] }, "card": { "title": "Sign in with Failure", "subtitle": "One OAuth for Codex, ChatGPT, Claude Code, and Grok Build.", "accent": "ember-glass" } }

Example authorize URL

https://oauth.failure.fail/oauth/authorize?response_type=code&client_id=YOUR_CLIENT_ID&redirect_uri=https://yourapp.com/callback&scope=openid%20profile%20email%20providers%20offline_access&code_challenge=CHALLENGE&code_challenge_method=S256&state=STATE