mirror of
https://github.com/supabase/supabase.git
synced 2026-12-06 08:29:01 +00:00
## Problem Scoped OAuth Apps M1 adds two settings to OAuth apps: **Use the permissions of the person who connects** and **Ask for specific projects**. Together they let any organization member authorize an app with their own role, and let people limit an app to the projects they choose. The settings are in private beta. The current OAuth docs assume an Owner or Administrator authorizes an app for the whole organization, and they describe tokens as having full Management API access. App authors have no guidance on what changes when they turn on either setting. Organization admins have nothing on reviewing or revoking member grants. Linear: [[CTRL-2123]](https://linear.app/supabase/project/oauth-app-granular-permissions-scoped-oauth-apps-23de6daf1501) ## Solution Four new guides under `build-a-supabase-oauth-integration/`, plus edits that weave scoped access into the existing Build an Integration pages and the docs nav. | Page | Type | For | | --- | --- | --- | | Scoped access for OAuth apps | Explainer | App authors deciding whether to turn the settings on | | Update your app for scoped access | Guide | App authors changing their code, including which roles can authorize each scope | | Test scoped access on a staging app | Guide | App authors testing before production | | Manage OAuth app access | Guide | Organization admins and members reviewing and revoking grants | Edits to existing pages: - **Build a Supabase OAuth integration:** - The intro no longer says tokens have "full access", and points to scoped access. - The authorize parameters add `project_ref`. - The callback section covers a canceled authorization (`error=access_denied` and `state`) and explains `scope` and `project_refs`, including `project_refs` being `null` for an all-projects grant. - The refresh section notes that a member leaving ends their grant. - **OAuth scopes:** a new "Scopes and member roles" section links to the role table. - **Navigation:** the four pages are added to "Supabase OAuth Integration" after "OAuth scopes" as **Scoped access**, **Update your app**, **Test on staging** and **Manage app access**. The entries are added in both nav files: `features/IaNav/option1/integrations.ts` and `components/Navigation/NavigationMenu/NavigationMenu.constants.ts`. Key choices: - **Explainer separate from the guides.** The overview has no instructions, so authors can decide whether to turn the settings on before reading the code changes. - **Role table in the update guide.** It's derived from the scope and role mapping, and sits next to the advice it supports. The OAuth scopes page links to it rather than duplicating it. - **Partial grants are described as not available in the dashboard.** The pages point authors to the "Handle scopes missing from the grant" section instead of naming an API field. - **No rollout dates.** Dates belong in the changelog and partner emails, per `03-page-structure.md`. The pages state private beta status and the support-ticket route only for the initial TPP rollout. ## Still to be added - **No API reference.** `project_ref` and `project_refs` come from the Management API OpenAPI spec, so field-level detail is out of scope here. ## Preview links See PR preview Head to `docs/guides/integrations/build-a-supabase-oauth-integration` ### Self-review Reviewed with `review-the-docs` (local self-review) before opening. - **Passed:** voice, structure, frontmatter, internal links, anchors and nav. Code snippets run with stub values. - **Formatting:** Prettier check passes on all changed files. A follow-up commit fixed table alignment in three new guides. - **Edits to existing pages:** tested against the live text of both pages. - **Still to run:** `pnpm build:guides-markdown`, and the `WORD_LIST.md` two-pass check, including "re-authorize" and "turn on" vs "select". ## Checklist Check all before review: - [x] I have read [CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md) - [x] If I wrote a new docs topic or edited an existing topic, I used the `/write-the-docs` or `/edit-the-docs` skill, which applies the docs [style guide](https://github.com/supabase/supabase/tree/master/apps/docs/style-guide) --------- Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com> Co-authored-by: Joshen Lim <joshenlimek@gmail.com> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
65 lines
6.3 KiB
Plaintext
65 lines
6.3 KiB
Plaintext
---
|
|
title: 'Test scoped access on a staging app'
|
|
subtitle: 'Check every member and project scenario before you go live'
|
|
description: 'Create a staging copy of your OAuth app, turn on scoped access settings, and test member and project scenarios before you change your production app.'
|
|
---
|
|
|
|
Test scoped access settings on a separate staging app before you change your production app. You can't turn off a setting after you save it, and a setting applies to every person who authorizes the app.
|
|
|
|
## Create a staging app
|
|
|
|
Create a second OAuth app that mirrors your production app. Follow the steps in [Create an OAuth app](/docs/guides/integrations/build-a-supabase-oauth-integration#create-an-oauth-app), with these differences:
|
|
|
|
- Select the same [scopes](/docs/guides/integrations/build-a-supabase-oauth-integration/oauth-scopes) as your production app.
|
|
- Set the redirect URL to your staging environment.
|
|
|
|
Then configure your staging environment to use the new app's client ID and client secret.
|
|
|
|
## Turn on scoped access
|
|
|
|
1. In the **OAuth Apps** tab, open your staging app's settings.
|
|
2. Select **Use the permissions of the person who connects**, **Ask for specific projects**, or both.
|
|
3. Save the app.
|
|
|
|
<Admonition type="note">
|
|
|
|
Scoped access is in private beta. If the settings don't appear on your app, [open a support ticket](/dashboard/support/new) and include your app's client ID to request access.
|
|
|
|
</Admonition>
|
|
|
|
## Set up a test organization
|
|
|
|
Create an organization with enough members and projects to cover each scenario:
|
|
|
|
- Members with the Owner, Administrator, Developer, and Read-only roles
|
|
- At least three projects
|
|
- On the Team or Enterprise plan, a member with a project-scoped role
|
|
|
|
## Test each scenario
|
|
|
|
Authorize your staging app as different members and check each result. Run only the scenarios for the settings you turned on, plus the scenarios marked **Any**. The Developer row applies only when every scope your app requests has a lowest role of Developer or lower. See [Request only the scopes you need](/docs/guides/integrations/build-a-supabase-oauth-integration/update-for-scoped-access#request-only-the-scopes-you-need). The Read-only row applies only when your app requests at least one write scope.
|
|
|
|
| Scenario | Setting | Expected result |
|
|
| --------------------------------------------------------------------- | ------------------ | ---------------------------------------------------------------------------------------------------------------------------------------- |
|
|
| A Developer authorizes the app | Member permissions | Authorization succeeds. Your app stores a connection for that member. |
|
|
| A Read-only member authorizes an app that requests write scopes | Member permissions | The consent screen shows a warning and the member can't approve. No redirect reaches your app. |
|
|
| A member's role is lowered after they authorize | Member permissions | Requests the role no longer covers return `403`. Your app prompts the person. |
|
|
| A member is removed from the organization | Member permissions | Requests return `403`. Your app tells the person to ask an administrator to restore their membership, or to have another member connect. |
|
|
| A member chooses **All current and future projects** | Project selection | Your app works with every project, as it does without the setting. |
|
|
| A project is created after an all-projects authorization | Project selection | Your app can reach the new project without re-authorization. |
|
|
| A member selects one of three projects | Project selection | Your app shows and changes only that project. |
|
|
| A member selects a project where their role doesn't cover your scopes | Both | The consent screen flags that project. The member deselects it to approve. |
|
|
| A project is created after a specific-projects authorization | Project selection | Your app doesn't show the project and offers to re-authorize. |
|
|
| A member re-authorizes to add a project | Project selection | The new selection replaces the old one. Your app keeps its state for kept projects. |
|
|
| Your app requests a branch | Project selection | The request uses the parent project's grant. |
|
|
| A person cancels on the consent screen | Any | Your redirect URL receives `error=access_denied`. Your app lets them try again. |
|
|
| An administrator revokes the app for the organization | Any | All member grants end. Your app handles the revoked tokens. |
|
|
|
|
## Turn on scoped access for production
|
|
|
|
After every scenario for the settings you turned on passes, turn on the same settings for your production app. Grants created before the change keep working, and the settings apply the next time a person authorizes your app.
|
|
|
|
Access is granted per app, so your production app needs its own request. If the settings don't appear on your production app, [open a support ticket](/dashboard/support/new) and include your production app's client ID.
|
|
|
|
For the code changes behind each scenario, see [Update your app for scoped access](/docs/guides/integrations/build-a-supabase-oauth-integration/update-for-scoped-access).
|