Files
supabase/apps/studio/components
Danny White 556faeab51 feat(studio): clarify authorized app grant details (#54284)
## Problem

The grants dialog makes project coverage and each member’s permissions
hard to inspect.

## Solution

- Replace the dialog with a grant-details sheet.
- Separate organisation and member access, with project references and
permissions grouped by access level.
- Move app IDs into Details and add a revoke action for authorised
admins.
- Build on #54285 using the existing grants API.

| Before | After |
| --- | --- |
| <img width="1280" height="1323" alt="OAuth Apps Organization Settings
Basket Supabase"
src="https://github.com/user-attachments/assets/b6bb0082-9cee-48b4-adb4-058f14f10f9f"
/> | <img width="1280" height="1323" alt="OAuth Apps Organization
Settings Basket Supabase"
src="https://github.com/user-attachments/assets/b32a7723-9fa0-452d-95f5-1762fd364163"
/> |
| <img width="1280" height="1185" alt="OAuth Apps Organization Settings
Basket Supabase"
src="https://github.com/user-attachments/assets/9a7982ba-aebe-42f4-9ac6-9308136150f7"
/> | <img width="1280" height="1221" alt="OAuth Apps Organization
Settings Basket Supabase"
src="https://github.com/user-attachments/assets/1965f7e4-8554-4fa9-86ef-7e53af1d0038"
/> |

## Review instructions

1. Sign in to staging and use an authorised app, or [authorise the test
app](https://api.supabase.green/v1/oauth/authorize?client_id=75e64165-b74e-432f-bb70-80d6ae432f06&response_type=code&redirect_uri=http%3A%2F%2Flocalhost%3A54321%2Fcallback&state=grant-sheet-review).
The localhost callback may fail after the grant is saved.
2. Open the
[preview](https://studio-staging-git-dnywh-oauth-grant-details-supabase.vercel.app/dashboard/org/_/apps#authorized-apps),
select the same organisation and choose **Manage app → View access**.
3. Check the grant sections, project references and permission groups.
Test narrow widths, closing the sheet and cancelling **Revoke access**.

### Mixed-grant overrides

In **DevTools → Network**, override only the GET ending in
`/oauth/approvals/<app-id>/grants` with this response. Save, reload and
reopen the sheet. Remove any parent `/approvals` override to avoid
Chrome’s file/folder clash.

<details>
<summary>grants.json</summary>

```json
{
  "data": [
    {
      "id": "22222222-2222-4222-8222-000000000001",
      "type": "oauth_grant",
      "attributes": {
        "approved_at": "2026-11-30T00:00:00Z",
        "approved_scopes": [
          "database:read",
          "database:write",
          "projects:read"
        ],
        "kind": "organization_bound",
        "projects": null,
        "user": null
      }
    },
    {
      "id": "22222222-2222-4222-8222-000000000002",
      "type": "oauth_grant",
      "attributes": {
        "approved_at": "2026-11-30T00:00:00Z",
        "approved_scopes": [
          "projects:read"
        ],
        "kind": "member_bound",
        "projects": [
          {
            "name": "Example storefront",
            "ref": "example-storefront"
          }
        ],
        "user": {
          "username": "alex",
          "email": "alex@example.com",
          "gotrue_id": "33333333-3333-4333-8333-000000000001"
        }
      }
    },
    {
      "id": "22222222-2222-4222-8222-000000000003",
      "type": "oauth_grant",
      "attributes": {
        "approved_at": "2026-11-30T00:00:00Z",
        "approved_scopes": [],
        "kind": "member_bound",
        "projects": [],
        "user": {
          "username": "sam",
          "email": "sam@example.com",
          "gotrue_id": "33333333-3333-4333-8333-000000000002"
        }
      }
    }
  ],
  "links": {
    "next": null,
    "prev": null
  }
}
```

</details>

Check that organisation access covers all projects, Alex has only read
access to Example storefront, and Sam has no projects or permissions.
Disable overrides when finished.

Requires `enableScopedOAuthManage` for the organisation.
2026-12-01 09:57:35 +11:00
..

Writing components

Where to create your components

  • For components that declare the general structure and layout of a page:
    • /components/layouts/xxx
  • For components that are tightly coupled to a specific interface:
    • /components/interfaces/xxx
  • For components that are meant to be reusable across multiple pages:
    • /components/ui/xxx
  • Note: We're gradually moving files out of the to-be-cleaned folder into the respective folders as we refactor

Component structure

  • If a component has constants and utility methods that are tightly coupled to itself, keep them close to the component and enclose them in a folder with an index.tsx as an entry point
  • Otherwise it can just be a file on its own
  • For example:
    • components/ui
      - SampleComponentA
        - SampleComponentA.tsx
        - SampleComponentA.constants.ts
        - SampleComponentA.utils.ts
        - SampleComponentA.types.ts
        - index.ts
      - SampleComponentB.tsx
      

Template for building components


// Declare the prop types of your component
interface ComponentAProps {
  sampleProp: string
}

// Name your component accordingly — use a named export, not a default export
export const ComponentA = ({ sampleProp }: ComponentAProps) => {
  return <div>ComponentA: {sampleProp}</div>
}