mirror of
https://github.com/supabase/supabase.git
synced 2026-12-05 16:09:06 +00:00
## Problem The steps to build a Supabase integration are spread across five pages: the Partner Catalog page, creating an OAuth app, OAuth scopes, the partner install flow, and the Management API reference. A partner has no single page that says where to start or what to do next. Linear: DOCS-1720. ## Solution Add one guide, **Build a Supabase integration**, as the first item under **Build Your Own** in the integrations sidebar. It does not repeat the detail on the other pages. It links to them. - **The path at a glance:** two short paths. Partner Catalog: apply, build a landing page, publish. Integration: apply, build the OAuth flow, build the integration, publish. - **Apply to the Partners program**, then **Choose: Partner Catalog or Integration**, a comparison table with wireframe images (SVG, light and dark). - **Partner Catalog: Build your landing page** and **Integration** (build the OAuth flow, build the integration), each with "Build it" cards that link to the top of the existing page. - **Publish:** ask the partner manager to list the partner on the Partner Catalog or the Integrations page. - Removes the redirect from `/docs/guides/integrations/build-a-supabase-integration` to the OAuth guide, so the new page is reachable at that URL. The old `/oauth-scopes` redirect stays. - The progression and card data is in `apps/docs/data/content-listings/build-a-supabase-integration.data.ts`. Not in this PR: edits to the existing pages. The cards link to page tops, so nothing here depends on those edits. ## Please check - The five progression icons are placeholders from the built-in set. New icons are coming. - The table images sit inside table cells with a fixed width. I checked them in the dev server only. - I rendered the page with `pnpm dev` and ran `oxfmt --check` on the changed files. I did not run the docs tests or `build:guides-markdown`. - Two details are unverified: how partners hand their public key to Supabase for a signed redirect, and partner status callbacks. The guide does not describe either. - The Dashboard Integrations tab wireframe is a drawing, not a screenshot. ## Preview links | Site | Live | Preview | Search for | | ---- | ---- | ------- | ---------- | | Docs | [/docs/guides/integrations/build-a-supabase-integration](https://supabase.com/docs/guides/integrations/build-a-supabase-integration) (redirects to the OAuth guide until this merges) | Vercel bot comment | `The path at a glance` | 🤖 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: Nik Richers <nik@validmind.ai> Co-authored-by: John Stokvis <johnstokvis@Johns-MacBook-Pro.local>
96 lines
3.2 KiB
TypeScript
96 lines
3.2 KiB
TypeScript
import { useParams } from 'common'
|
|
import { useState } from 'react'
|
|
import { Alert, AlertTitle, InfoIcon } from 'ui'
|
|
|
|
import { SecretRow } from './SecretRow'
|
|
import { ButtonTooltip } from '@/components/ui/ButtonTooltip'
|
|
import { InlineLink } from '@/components/ui/InlineLink'
|
|
import { useClientSecretCreateMutation } from '@/data/oauth-secrets/client-secret-create-mutation'
|
|
import { CreatedSecret, useClientSecretsQuery } from '@/data/oauth-secrets/client-secrets-query'
|
|
import { OAuthApp } from '@/data/oauth/oauth-apps-query'
|
|
import { FGA_PERMISSIONS, useAsyncCheckPermissionsV2 } from '@/hooks/misc/useCheckPermissionsV2'
|
|
import { DOCS_URL } from '@/lib/constants'
|
|
|
|
interface Props {
|
|
selectedApp?: OAuthApp
|
|
}
|
|
|
|
export const OAuthSecrets = ({ selectedApp }: Props) => {
|
|
const { slug } = useParams()
|
|
const [createdSecret, setCreatedSecret] = useState<CreatedSecret>()
|
|
const { can: canManageSecrets } = useAsyncCheckPermissionsV2(
|
|
FGA_PERMISSIONS.ORGANIZATION.CONFIG_WRITE
|
|
)
|
|
|
|
const { id: appId } = selectedApp ?? {}
|
|
|
|
const { data } = useClientSecretsQuery({ slug, appId })
|
|
const secrets = data?.client_secrets ?? []
|
|
|
|
const { mutate: createSecret, isPending: isCreatingSecret } = useClientSecretCreateMutation({
|
|
onSuccess: (data) => setCreatedSecret(data),
|
|
})
|
|
|
|
const handleCreateSecret = () => {
|
|
if (!slug) return console.error('Slug is required')
|
|
if (!appId) return console.error('App ID is required')
|
|
createSecret({ slug, appId })
|
|
}
|
|
|
|
return (
|
|
<div className="flex flex-col gap-4">
|
|
<div className="flex items-center justify-between">
|
|
<div className="flex flex-col">
|
|
<span className="text-sm text-foreground">Client secrets</span>
|
|
<span className="text-sm text-foreground-light">
|
|
For handling callbacks in the OAuth 2.0 flow. Learn more{' '}
|
|
<InlineLink
|
|
href={`${DOCS_URL}/guides/integrations/build-a-supabase-oauth-integration#handling-the-callback`}
|
|
>
|
|
here
|
|
</InlineLink>
|
|
.
|
|
</span>
|
|
</div>
|
|
|
|
{canManageSecrets && (
|
|
<ButtonTooltip
|
|
disabled={!appId || secrets.length >= 5}
|
|
onClick={handleCreateSecret}
|
|
loading={isCreatingSecret}
|
|
tooltip={{
|
|
content: {
|
|
side: 'bottom',
|
|
text: secrets.length >= 5 ? 'You can only have up to 5 client secrets' : undefined,
|
|
},
|
|
}}
|
|
>
|
|
Generate new secret
|
|
</ButtonTooltip>
|
|
)}
|
|
</div>
|
|
|
|
{createdSecret && (
|
|
<Alert variant="default">
|
|
<InfoIcon />
|
|
<AlertTitle>
|
|
Make sure to copy your new client secret now. You won't be able to see it again.
|
|
</AlertTitle>
|
|
</Alert>
|
|
)}
|
|
|
|
<div className="-space-y-px">
|
|
{secrets
|
|
.sort((a, b) => new Date(b.created_at).getTime() - new Date(a.created_at).getTime())
|
|
.map((secret) => {
|
|
const isNew = createdSecret?.id === secret.id
|
|
const _secret = isNew
|
|
? { ...secret, client_secret: createdSecret.client_secret }
|
|
: secret
|
|
return <SecretRow key={secret.id} secret={_secret} appId={appId} />
|
|
})}
|
|
</div>
|
|
</div>
|
|
)
|
|
}
|