The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
docs: subdomain sso (#30424)
Kyle Malloyefd536e59959
diff --git a/apps/docs/content/guides/auth/enterprise-sso/auth-sso-saml.mdx b/apps/docs/content/guides/auth/enterprise-sso/auth-sso-saml.mdxindex 59a5c388ae4..7e41fc0adb1 100644--- a/apps/docs/content/guides/auth/enterprise-sso/auth-sso-saml.mdx+++ b/apps/docs/content/guides/auth/enterprise-sso/auth-sso-saml.mdx@@ -421,3 +421,47 @@ If you really need access to the key, please [open a support ticket](https://supYes, Supabase supports multi-tenant Single Sign-On (SSO) using SAML 2.0. While the dashboard displays only one SAML field, you can set up multiple SAML connections using the Supabase CLI.Each connection is assigned a unique `sso_provider_id`, which is included in the user's JWT and can be used in Row Level Security (RLS) policies. You can configure custom attribute mappings for each connection to include tenant-specific information, such as roles.This setup allows you to implement multi-tenant SSO for multiple clients or organizations within a single application. For example, if you have an app with multiple clients using different Azure Active Directories, you can create separate SAML connections for each and use the `sso_provider_id` to manage access and apply appropriate security policies.++### Is multi-subdomain SSO with SAML supported?++Yes, also referred to as [cross-origin authentication within the same site](https://web.dev/articles/same-site-same-origin). To redirect to a URL other than the [Site URL](https://supabase.com/docs/guides/auth/redirect-urls), following the SAML response from the IdP, the `redirectTo` option can be added to [`signInWithSSO`](https://supabase.com/docs/reference/javascript/auth-signinwithsso).++```ts+ const { data, error } = await supabase.auth.signInWithSSO({+ domain: 'company.com'+ options: {+ redirectTo: `https://app.company.com/callback`,+ },+ })+```++When redirecting to a URL other than the Site URL, a `/callback` endpoint is necessary to process the auth code from the IdP and exchange it for a session. This assumes the [Supabase SSR client](https://supabase.com/docs/guides/auth/server-side/creating-a-client) has already been configured.++<Tabs scrollable size="small" type="underlined" defaultActiveId="sveltekit" queryGroup="framework">++<TabPanel id="sveltekit" label="SvelteKit">++```ts+import { error, redirect } from '@sveltejs/kit'+import type { RequestHandler } from './$types'++export const GET: RequestHandler = async ({ url, locals }) => {+ const code = url.searchParams.get('code')++ if (!code) {+ error(400, 'No authorization code provided')+ }++ const { error: tokenExchangeError } = await locals.supabase.auth.exchangeCodeForSession(code)++ if (tokenExchangeError) {+ error(400, 'Failed to exchange authorization code for session')+ }++ redirect(303, '/')+}+```++</TabPanel>++</Tabs>