Commit Graph
1 Commits
Author SHA1 Message Date
Charis bde5e81f3a feat(studio): gate docs and project API docs api-keys consumers on grants (#52961)
Part 1 of 6 in a stack for
[FE-4731](https://linear.app/supabase/issue/FE-4731/grants-rollout-api-keys-consumers-that-only-need-publishable-keys).

## Stack
1. 👉 #52961 Docs and project API docs consumers
2. #52962 Edge functions and vector bucket examples
3. #52963 Integrations landing data
4. #52964 Connect sheet and project connection popover; remove the
transitional api-keys hooks
5. #52965 `reveal` refinement for single api-key reads; API key pill
6. #52966 API key create and delete

## Changes
Moves api-keys consumers that only need publishable keys from the V2
`API_GATEWAY_KEYS_READ` check and the transitional `useAPIKeys` /
`useAPIKeysQuery` hooks onto a plain `GET /v1/projects/{ref}/api-keys`
grant with `apiKeysQueryOptions`:
- Docs: `Authentication` and `LangSelector`
- Project API docs: `ProjectAPIDocs` (still only fetches while the panel
is open) and `Content/Introduction`

Without access, the docs keep their placeholder keys:
- On the Data API docs page, the key picker in `LangSelector` is hidden
and `Authentication` keeps the placeholder. There's no inline note.
- In the API docs slideover, "Show keys" is disabled, with a tooltip
saying the user needs additional permissions (or that the permission
check failed).

The old guards matched the endpoint annotation
(`api_gateway_keys_read`).

## Testing
- `Docs/ApiKeysGrants.platform.test.tsx`: `LangSelector` offers keys
when granted, and hides the picker without requesting keys when denied
or when the permission check fails. `Authentication` prefills the key
when granted and keeps the placeholder otherwise.
- `ProjectAPIDocs/ProjectAPIDocs.platform.test.tsx`: "Show keys" reveals
the client key when granted; when denied or errored it's disabled with
the matching tooltip, and no keys are requested.

🤖 Generated with [Claude Code](https://claude.com/claude-code)
2026-11-04 15:45:46 -05:00