Skip to content

Serve atproto OAuth client metadata at /oauth-client-metadata.json by default, configurable (v0.6.0) - #112

Merged
sergeychernyshev merged 1 commit into
mainfrom
atproto-root-client-metadata
Aug 22, 2026
Merged

sergeychernyshev merged 1 commit into
mainfrom
atproto-root-client-metadata

Conversation

@sergeychernyshev

Copy link
Copy Markdown
Member

Why

The atproto OAuth spec allows the client-metadata document at any https:// URL, but /oauth-client-metadata.json at the domain root is the recognized convention. The reference PDS consent UI (isConventionalOAuthClientId, ClientName) shows just the hostname for a client_id at that exact path and the full URL with path for anything else — so users of apps on StartupAPI saw https://host/users/auth/atproto/client-metadata.json on the Bluesky consent screen.

(client_name / logo_uri are only ever shown for clients the PDS operator allowlists via PDS_OAUTH_TRUSTED_CLIENTS; no path changes that. Documented.)

What

  • Default: document served at /oauth-client-metadata.json and used as client_id — the only route StartupAPI claims outside USERS_PATH.
  • New atproto options:
    • useRootOAuthClientMetadata (default true); false keeps the document and client_id under USERS_PATH as before.
    • customOAuthClientMetadataURL — a self-hosted document (root-relative path or absolute https:// URL) becomes client_id; StartupAPI does not claim the root path and keeps a reference copy under USERS_PATH to mirror. Requires useRootOAuthClientMetadata: false (config error otherwise).
  • handleProviderExtraRoutes extracted from handleAuth and run before the USERS_PATH routing in createStartupAPI.
  • Tests for all three modes, PAR/authorize client_id, and both config errors. README section with a mode table and the consent-screen / trusted-client caveats.

⚠️ Breaking change

The default client_id changes, which invalidates existing atproto authorizations — users just log in again. Set useRootOAuthClientMetadata: false to keep the previous client_id.

🤖 Generated with Claude Code

… default, configurable (v0.6.0)

The reference PDS consent screen shows just the hostname for a client_id at the
conventional root path and the full URL for any other path. Serve the document
at the root by default and use it as client_id.

- useRootOAuthClientMetadata (default true); false keeps it under USERS_PATH
- customOAuthClientMetadataURL for a self-hosted document (requires the flag
  off); StartupAPI keeps a reference copy under USERS_PATH to mirror
- handleProviderExtraRoutes runs before USERS_PATH routing so a provider can
  claim a root path
- README section on the three modes, consent-screen behavior and
  PDS_OAUTH_TRUSTED_CLIENTS

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Aug 22, 2026 •

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
startup-api 677e465 Aug 22 2026, 07:01 PM

@sergeychernyshev
sergeychernyshev merged commit a03b738 into main Aug 22, 2026
2 checks passed
@sergeychernyshev
sergeychernyshev deleted the atproto-root-client-metadata branch August 22, 2026 19:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant