Skip to content

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

fix: add query params for simple-redirect integrations (#45562)

Alex Hall8a5e60993602
diff --git a/apps/studio/components/interfaces/Integrations/Integration/IntegrationOverviewTabV2/InstallIntegrationSheet/InstallOAuthIntegrationButton.tsx b/apps/studio/components/interfaces/Integrations/Integration/IntegrationOverviewTabV2/InstallIntegrationSheet/InstallOAuthIntegrationButton.tsx
index 5e695ad6aa3..fb08a5e10c6 100644
--- a/apps/studio/components/interfaces/Integrations/Integration/IntegrationOverviewTabV2/InstallIntegrationSheet/InstallOAuthIntegrationButton.tsx
+++ b/apps/studio/components/interfaces/Integrations/Integration/IntegrationOverviewTabV2/InstallIntegrationSheet/InstallOAuthIntegrationButton.tsx
@@ -6,6 +6,7 @@ import { Button } from 'ui'
import type { IntegrationDefinition } from '@/components/interfaces/Integrations/Landing/Integrations.constants'
import { useAPIKeysQuery } from '@/data/api-keys/api-keys-query'
import { useInstallOAuthIntegrationMutation } from '@/data/marketplace/install-oauth-integration-mutation'
+import { useSelectedOrganizationQuery } from '@/hooks/misc/useSelectedOrganization'
interface InstallOAuthIntegrationButtonProps {
integration: IntegrationDefinition
@@ -13,6 +14,7 @@ interface InstallOAuthIntegrationButtonProps {
export function InstallOAuthIntegrationButton({ integration }: InstallOAuthIntegrationButtonProps) {
const { ref: projectRef } = useParams()
+ const { data: selectedOrg } = useSelectedOrganizationQuery()
const { data: apiKeys, isLoading: isApiKeysLoading } = useAPIKeysQuery(
{ projectRef, reveal: false },
@@ -55,7 +57,16 @@ export function InstallOAuthIntegrationButton({ integration }: InstallOAuthInteg
if (!integration.listingId) return toast.error('Listing ID is required')
installOAuthIntegration({ projectRef, id: integration.listingId })
} else {
- window.location.href = integration.installUrl ?? '/'
+ let redirectUrl = '/'
+
+ if (integration.installUrl) {
+ const url = new URL(integration.installUrl)
+ url.searchParams.append('organization_slug', selectedOrg?.slug ?? '')
+ url.searchParams.append('project_id', projectRef)
+ redirectUrl = url.href
+ }
+
+ window.open(redirectUrl, '_blank', 'noreferrer')
}
}