Files
9b3435010c fix(studio): show client ID and app ID on OAuth apps page (#54324)
## Problem

On the OAuth apps page in Studio, the table showed only the Client ID,
and the edit panel showed the app ID as unlabeled `ID: ...` text under
the app name. It was hard to tell the two IDs apart, or to copy the
right one. That contributed to the wrong ID type being handed to the
team that manages the Stripe pipeline allowlist (incident, Nov 20–23).

## Solution

- **Table:** add an **App ID** column next to **Client ID**. Both are
shown shortened (`65****9a71`) with a copy button. Hover an ID to show
the whole value. The copy button always copies the whole value.
- **Edit panel:** show **Client ID** and **App ID** as separate labeled,
copiable fields (full value, not shortened), each with one line of
helper text:
- Client ID: "Used to identify your app when it makes OAuth requests to
Supabase."
- App ID: "Used to manage your app on Supabase, such as updating or
deleting it."
- Remove the old `ID: ...` description under the app name.
- Add one small shared component, `OAuthAppId`, used by the table and
the edit panel.

The helper text follows the discussion in Slack: `client_id` is what the
deployed app sends in OAuth requests to the Management API, and `app_id`
is the primary key the app's author uses in platform APIs (for example
to update or delete the app).

Not in this PR: the Authorized apps table already shows its App ID with
a copy button, so it is unchanged. No API or data changes.

## Please check

- **Helper text wording.** Is it accurate for both IDs?
- **Shortened IDs.** The first 2 and last 4 characters, with `****`
between, only for IDs longer than 20 characters.

## Review instructions

1. Open **Organization → OAuth Apps** (`/org/<slug>/apps`) and create an
app if there is none.
2. In **Publishable apps**, check that **Client ID** and **App ID** both
show as shortened values, and that each copy button copies the full
value.
3. Hover a shortened ID. It should show a tooltip with the full value.
4. Open the app's edit panel. Check that Client ID and App ID are
labeled, show the full value, and copy correctly, and that the old `ID:
...` text under the app name is gone.

Checked locally against the full platform stack (format, lint,
type-check, and by eye). No tests added: the change is layout and
display only.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: John Stokvis <345546350+stokvis-at-supabase@users.noreply.github.com>
Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-authored-by: kemal <hello@kemal.earth>
2026-11-30 15:55:56 -06:00

116 lines
3.7 KiB
TypeScript

import { EditIcon, MoreVerticalIcon, TrashIcon } from 'lucide-react'
import {
Button,
DropdownMenu,
DropdownMenuContent,
DropdownMenuItem,
DropdownMenuSeparator,
DropdownMenuTrigger,
TableCell,
TableRow,
Tooltip,
TooltipContent,
TooltipTrigger,
} from 'ui'
import { TimestampInfo } from 'ui-patterns/TimestampInfo'
import { OAuthAppId } from './OAuthAppId'
import type { OAuthApp } from '@/data/oauth/oauth-apps-query'
import { FGA_PERMISSIONS, useAsyncCheckPermissionsV2 } from '@/hooks/misc/useCheckPermissionsV2'
export interface OAuthAppRowProps {
app: OAuthApp
onSelectEdit: () => void
onSelectDelete: () => void
}
export const OAuthAppRow = ({ app, onSelectEdit, onSelectDelete }: OAuthAppRowProps) => {
const { can: canUpdateOAuthApps } = useAsyncCheckPermissionsV2(
FGA_PERMISSIONS.ORGANIZATION.CONFIG_WRITE
)
const { can: canDeleteOAuthApps } = useAsyncCheckPermissionsV2(
FGA_PERMISSIONS.ORGANIZATION.CONFIG_WRITE
)
return (
<TableRow>
<TableCell className="w-[54px] min-w-[54px] max-w-[54px] pr-2">
<div
className="w-[30px] h-[30px] rounded-full bg-no-repeat bg-cover bg-center border border-control flex items-center justify-center text-xs"
style={{ backgroundImage: app.icon ? `url('${app.icon}')` : 'none' }}
>
{!!app.icon ? '' : `${app.name[0]}`}
</div>
</TableCell>
<TableCell className="pl-0">
<p title={app.name} className="truncate">
{app.name}
</p>
</TableCell>
<TableCell>
<OAuthAppId id={app.id} />
</TableCell>
<TableCell>
<OAuthAppId id={app.client_id ?? ''} />
</TableCell>
<TableCell>
<TimestampInfo
utcTimestamp={app.created_at ?? ''}
labelFormat="DD/MM/YYYY, HH:mm:ss"
className="text-sm"
/>
</TableCell>
<TableCell className="text-right">
<DropdownMenu>
<DropdownMenuTrigger asChild>
<Button icon={<MoreVerticalIcon />} className="px-1" />
</DropdownMenuTrigger>
<DropdownMenuContent align="end" side="bottom" className="w-32">
<Tooltip>
<TooltipTrigger asChild>
<DropdownMenuItem
key="edit"
disabled={!canUpdateOAuthApps}
className="space-x-2 pointer-events-auto!"
onClick={() => {
if (canUpdateOAuthApps) onSelectEdit()
}}
>
<EditIcon size={16} />
<p>Edit app</p>
</DropdownMenuItem>
</TooltipTrigger>
{!canUpdateOAuthApps && (
<TooltipContent side="left">
You need additional permissions to edit apps
</TooltipContent>
)}
</Tooltip>
<DropdownMenuSeparator />
<Tooltip>
<TooltipTrigger asChild>
<DropdownMenuItem
disabled={!canDeleteOAuthApps}
className="space-x-2 pointer-events-auto!"
key="delete"
onClick={() => {
if (canDeleteOAuthApps) onSelectDelete()
}}
>
<TrashIcon size={16} />
<p>Delete app</p>
</DropdownMenuItem>
</TooltipTrigger>
{!canDeleteOAuthApps && (
<TooltipContent side="left">
You need additional permissions to delete apps
</TooltipContent>
)}
</Tooltip>
</DropdownMenuContent>
</DropdownMenu>
</TableCell>
</TableRow>
)
}