From b529c1176fec4eb9f24a82bdace45952ca0af5ae Mon Sep 17 00:00:00 2001 From: Terry Sutton Date: Fri, 16 Jun 2023 14:10:25 -0230 Subject: [PATCH] Use custom domain in provider list, if we have one --- .../Auth/AuthProvidersForm/ProviderForm.tsx | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/studio/components/interfaces/Auth/AuthProvidersForm/ProviderForm.tsx b/studio/components/interfaces/Auth/AuthProvidersForm/ProviderForm.tsx index 7e70bcebd4d..673fdaebd80 100644 --- a/studio/components/interfaces/Auth/AuthProvidersForm/ProviderForm.tsx +++ b/studio/components/interfaces/Auth/AuthProvidersForm/ProviderForm.tsx @@ -9,6 +9,8 @@ import { BASE_PATH } from 'lib/constants' import { Provider } from './AuthProvidersForm.types' import { ProviderCollapsibleClasses } from './AuthProvidersForm.constants' import FormField from './FormField' +import { useCustomDomainsQuery } from 'data/custom-domains/custom-domains-query' +import { useParams } from 'common' interface Props { provider: Provider @@ -17,10 +19,12 @@ interface Props { const ProviderForm: FC = ({ provider }) => { const [open, setOpen] = useState(false) const { authConfig, ui } = useStore() - + const { ref } = useParams() const doubleNegativeKeys = ['MAILER_AUTOCONFIRM', 'SMS_AUTOCONFIRM'] const canUpdateConfig = checkPermissions(PermissionAction.UPDATE, 'custom_config_gotrue') + const { data: customDomainData } = useCustomDomainsQuery({ projectRef: ref }) + const generateInitialValues = () => { const initialValues: { [x: string]: string } = {} Object.keys(provider.properties).forEach((key) => { @@ -153,7 +157,11 @@ const ProviderForm: FC = ({ provider }) => { readOnly disabled label="Redirect URL" - value={`https://${ui.selectedProjectRef}.supabase.co/auth/v1/callback`} + value={ + customDomainData?.customDomain + ? `https://${customDomainData.customDomain?.hostname}/auth/v1/callback` + : `https://${ui.selectedProjectRef}.supabase.co/auth/v1/callback` + } /> )}