Skip to content

fix(cloudflare): add flagship:write to the OAuth scope catalog - #1032

Draft
aryasaatvik wants to merge 1 commit into
alchemy-run:mainfrom
aryasaatvik:fix/cloudflare-flagship-oauth-scope
Draft

fix(cloudflare): add flagship:write to the OAuth scope catalog#1032
aryasaatvik wants to merge 1 commit into
alchemy-run:mainfrom
aryasaatvik:fix/cloudflare-flagship-oauth-scope

Conversation

@aryasaatvik

@aryasaatvik aryasaatvik commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

The OAuth scope catalog has no Flagship entry, so OAuth-authenticated profiles can't use Cloudflare.Flagship.* resources — the first call fails:

Unauthorized: Authentication error
  at GET /accounts/{account_id}/flagship/apps

Adds flagship:write to ALL_SCOPES and DEFAULT_SCOPES. Name and description match Cloudflare's own catalog (workers-auth/src/core/scopes.ts in workers-sdk), where wrangler defaults it.

Blocked on client registration, verified: Cloudflare's authorize endpoint rejects the scope for alchemy's OAuth client:

error=invalid_scope
error_description=The OAuth 2.0 Client is not allowed to request scope 'flagship:write'.

So this needs Cloudflare to allowlist flagship:write on client 6d8c2255-0773-45f6-b376-2914632e6f91 first; until then the DEFAULT_SCOPES line would break every login. Draft until that lands — happy to split the catalog-only line out if you'd rather ship it independently.

The scope catalog had no Flagship entry, so OAuth-authenticated profiles could never use Cloudflare.Flagship resources — the first API call fails with a generic Unauthorized. Scope name and description match Cloudflare's shared auth catalog in workers-sdk, where wrangler requests it by default.
@sam-goodwin

Copy link
Copy Markdown
Contributor

Is there a flahship:read too? Or only write?

@aryasaatvik

Copy link
Copy Markdown
Contributor Author

Only flagship:write. Cloudflare's shared OAuth catalog (workers-auth/src/core/scopes.ts in workers-sdk) has no flagship:read — same pattern as d1:write/queues:write, which are write-only scopes. Read granularity only exists in the API-token permission system ("Flagship Read" / "Flagship Edit" permission groups).

Write is also what the resources need end to end: plan only GETs, but deploy creates/updates apps and flags.

@sam-goodwin

Copy link
Copy Markdown
Contributor

cc @BlankParticle

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.

2 participants