Skip to content

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

feat: put firebase auth tpa behind feature flag (#28511)

Stojan Dimitrovski08b162e9e3dd
diff --git a/apps/studio/components/interfaces/Auth/ThirdPartyAuthForm/CreateFirebaseAuthDialog.tsx b/apps/studio/components/interfaces/Auth/ThirdPartyAuthForm/CreateFirebaseAuthDialog.tsx
index 1a14d40b2e7..ceedf23eff1 100644
--- a/apps/studio/components/interfaces/Auth/ThirdPartyAuthForm/CreateFirebaseAuthDialog.tsx
+++ b/apps/studio/components/interfaces/Auth/ThirdPartyAuthForm/CreateFirebaseAuthDialog.tsx
@@ -7,6 +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_,
@@ -68,6 +69,13 @@ 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({
@@ -101,10 +109,11 @@ export const CreateFirebaseAuthIntegrationDialog = ({
<Separator />
<DialogSection>
- <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_
+ {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_
key="enabled"
control={form.control}
name="enabled"
@@ -126,52 +135,81 @@ 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">
+ 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>
+ )}
</DialogSection>
<DialogFooter>
- {!isCreating && (
- <div className="flex-1">
- <Button type="danger" onClick={() => onDelete()} icon={<Trash />}>
- Remove connection
+ {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
</Button>
- </div>
+ <Button onClick={() => onClose()} asChild>
+ <a href="https://forms.supabase.com/third-party-auth-with-firebase" target="_blank">
+ Register interest
+ </a>
+ </Button>
+ </>
)}
-
- <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>