Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

feat: make firebase tpa generally available (#32573)

Stojan Dimitrovski3122efc7b7e2
diff --git a/apps/studio/components/interfaces/Auth/ThirdPartyAuthForm/AddIntegrationDropdown.tsx b/apps/studio/components/interfaces/Auth/ThirdPartyAuthForm/AddIntegrationDropdown.tsx
index 2088848282b..71bb7e01fd4 100644
--- a/apps/studio/components/interfaces/Auth/ThirdPartyAuthForm/AddIntegrationDropdown.tsx
+++ b/apps/studio/components/interfaces/Auth/ThirdPartyAuthForm/AddIntegrationDropdown.tsx
@@ -4,6 +4,7 @@ import Image from 'next/image'
import { IS_PLATFORM } from 'common'
import { useOrgSubscriptionQuery } from 'data/subscriptions/org-subscription-query'
import { useSelectedOrganization } from 'hooks/misc/useSelectedOrganization'
+import Link from 'next/link'
import {
Button,
cn,
@@ -19,7 +20,6 @@ import {
getIntegrationTypeLabel,
INTEGRATION_TYPES,
} from './ThirdPartyAuthForm.utils'
-import Link from 'next/link'
interface AddIntegrationDropdownProps {
buttonText?: string
@@ -68,6 +68,9 @@ export const AddIntegrationDropdown = ({
</Button>
</DropdownMenuTrigger>
<DropdownMenuContent align="end" className="w-56">
+ <DropdownMenuLabel>Select Provider</DropdownMenuLabel>
+ <DropdownMenuSeparator />
+
<ProviderDropdownItem type="firebase" onSelectIntegrationType={onSelectIntegrationType} />
{subscription?.plan.id === 'free' ? (
diff --git a/apps/studio/components/interfaces/Auth/ThirdPartyAuthForm/CreateFirebaseAuthDialog.tsx b/apps/studio/components/interfaces/Auth/ThirdPartyAuthForm/CreateFirebaseAuthDialog.tsx
index 32de8cae74d..4c49a1fefc1 100644
--- a/apps/studio/components/interfaces/Auth/ThirdPartyAuthForm/CreateFirebaseAuthDialog.tsx
+++ b/apps/studio/components/interfaces/Auth/ThirdPartyAuthForm/CreateFirebaseAuthDialog.tsx
@@ -1,5 +1,5 @@
import { zodResolver } from '@hookform/resolvers/zod'
-import { AlertTriangle, Trash } from 'lucide-react'
+import { Trash } from 'lucide-react'
import { useEffect } from 'react'
import { SubmitHandler, useForm } from 'react-hook-form'
import { toast } from 'sonner'
@@ -7,11 +7,7 @@ import * as z from 'zod'
import { useParams } from 'common'
import { useCreateThirdPartyAuthIntegrationMutation } from 'data/third-party-auth/integration-create-mutation'
-import { useFlag } from 'hooks/ui/useFlag'
import {
- AlertDescription_Shadcn_,
- AlertTitle_Shadcn_,
- Alert_Shadcn_,
Button,
Dialog,
DialogContent,
@@ -69,13 +65,6 @@ export const CreateFirebaseAuthIntegrationDialog = ({
},
})
- const allowedProjectIDs = useFlag<string | null | undefined>('firebaseTPAAllowedProjectIDs')
-
- const isAvailable =
- typeof allowedProjectIDs === 'string'
- ? allowedProjectIDs.split(',').includes(projectRef!)
- : !!allowedProjectIDs
-
useEffect(() => {
if (visible) {
form.reset({
@@ -109,11 +98,10 @@ export const CreateFirebaseAuthIntegrationDialog = ({
<Separator />
<DialogSection>
- {isAvailable ? (
- <Form_Shadcn_ {...form}>
- <form id={FORM_ID} onSubmit={form.handleSubmit(onSubmit)} className="space-y-4">
- {/* Enabled flag can't be changed for now because there's no update API call for integrations */}
- {/* <FormField_Shadcn_
+ <Form_Shadcn_ {...form}>
+ <form id={FORM_ID} onSubmit={form.handleSubmit(onSubmit)} className="space-y-4">
+ {/* Enabled flag can't be changed for now because there's no update API call for integrations */}
+ {/* <FormField_Shadcn_
key="enabled"
control={form.control}
name="enabled"
@@ -135,81 +123,40 @@ export const CreateFirebaseAuthIntegrationDialog = ({
/>
<Separator /> */}
- <p className="text-sm text-foreground-light">
- This will enable a JWT token from a specific Firebase project to access data from
- this Supabase project.
- </p>
- <FormField_Shadcn_
- key="firebaseProjectId"
- control={form.control}
- name="firebaseProjectId"
- render={({ field }) => (
- <FormItemLayout label="Firebase Auth Project ID">
- <FormControl_Shadcn_>
- <Input_Shadcn_ {...field} />
- </FormControl_Shadcn_>
- </FormItemLayout>
- )}
- />
-
- <Alert_Shadcn_ variant="warning">
- <AlertTriangle strokeWidth={2} />
- <AlertTitle_Shadcn_>
- This connection requires a Row Level Security (RLS) policy
- </AlertTitle_Shadcn_>
- <AlertDescription_Shadcn_>
- You will need to manually add a RLS policy after creating this Firebase
- connection. Otherwise, the Supabase project will be accessible to anyone with a
- valid Firebase JWT token.
- </AlertDescription_Shadcn_>
- </Alert_Shadcn_>
- </form>
- </Form_Shadcn_>
- ) : (
- <p className="text-sm text-foreground-light pb-2">
- Third-party Auth with Firebase is currently in a private alpha release.{' '}
- <a
- className="underline"
- href="https://forms.supabase.com/third-party-auth-with-firebase"
- target="_blank"
- >
- Please submit your interest for it
- </a>{' '}
- and someone from the Supabase team will reach out. You can also try it out via the
- CLI.
- </p>
- )}
+ <p className="text-sm text-foreground-light">
+ This will enable a JWT token from a specific Firebase project to access data from
+ this Supabase project.
+ </p>
+ <FormField_Shadcn_
+ key="firebaseProjectId"
+ control={form.control}
+ name="firebaseProjectId"
+ render={({ field }) => (
+ <FormItemLayout label="Firebase Auth Project ID">
+ <FormControl_Shadcn_>
+ <Input_Shadcn_ {...field} />
+ </FormControl_Shadcn_>
+ </FormItemLayout>
+ )}
+ />
+ </form>
+ </Form_Shadcn_>
</DialogSection>
<DialogFooter>
- {isAvailable ? (
- <>
- {!isCreating && (
- <div className="flex-1">
- <Button type="danger" onClick={() => onDelete()} icon={<Trash />}>
- Remove connection
- </Button>
- </div>
- )}
-
- <Button disabled={isLoading} type="default" onClick={() => onClose()}>
- Cancel
- </Button>
- <Button form={FORM_ID} htmlType="submit" disabled={isLoading} loading={isLoading}>
- {isCreating ? 'Create connection' : 'Update connection'}
- </Button>
- </>
- ) : (
- <>
- <Button disabled={isLoading} type="default" onClick={() => onClose()}>
- Cancel
+ {!isCreating && (
+ <div className="flex-1">
+ <Button type="danger" onClick={() => onDelete()} icon={<Trash />}>
+ Remove connection
</Button>
- <Button onClick={() => onClose()} asChild>
- <a href="https://forms.supabase.com/third-party-auth-with-firebase" target="_blank">
- Register interest
- </a>
- </Button>
- </>
+ </div>
)}
+
+ <Button disabled={isLoading} type="default" onClick={() => onClose()}>
+ Cancel
+ </Button>
+ <Button form={FORM_ID} htmlType="submit" disabled={isLoading} loading={isLoading}>
+ {isCreating ? 'Create connection' : 'Update connection'}
+ </Button>
</DialogFooter>
</DialogContent>
</Dialog>
diff --git a/apps/studio/components/interfaces/Auth/ThirdPartyAuthForm/IntegrationCard.tsx b/apps/studio/components/interfaces/Auth/ThirdPartyAuthForm/IntegrationCard.tsx
index a8cb879cd4f..97156cfe595 100644
--- a/apps/studio/components/interfaces/Auth/ThirdPartyAuthForm/IntegrationCard.tsx
+++ b/apps/studio/components/interfaces/Auth/ThirdPartyAuthForm/IntegrationCard.tsx
@@ -177,38 +177,6 @@ export const IntegrationCard = ({
)}
</div>
</div>
- {type === 'firebase' ? (
- <div className="bg-alternative border overflow-hidden shadow pl-11 pr-4 py-5 flex flex-row space-x-4">
- <div className="bg-warning h-5 w-5 text-black flex items-center justify-center rounded-md">
- <ExclamationCircleIcon className="h-4 w-4 text-black" />
- </div>
- <div className="text-sm space-y-4">
- <div className="space-y-1">
- <p className="text-foreground">Firebase provider uses a custom RLS policy</p>
- <p className="text-foreground-light">
- Be aware that this provider requires an RLS policy to correctly work.
- </p>
- </div>
-
- <Dialog>
- <DialogTrigger asChild>
- <Button type="warning" size="tiny">
- Insert policy
- </Button>
- </DialogTrigger>
- <DialogContent size="xlarge">
- <AddRLSPolicyForFirebaseDialog
- projectRef={projectRef!}
- firebaseProjectId={
- integration.oidc_issuer_url?.replace('https://securetoken.google.com/', '') ||
- ''
- }
- />
- </DialogContent>
- </Dialog>
- </div>
- </div>
- ) : null}
</>
)
}