Skip to content

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

ref: Use better error message for SSO provider mismatch for invites (#23438)

Kamil Ogórekc74ba90576e9
diff --git a/apps/studio/pages/join/index.tsx b/apps/studio/pages/join/index.tsx
index 89be3ea773a..cd767fffef3 100644
--- a/apps/studio/pages/join/index.tsx
+++ b/apps/studio/pages/join/index.tsx
@@ -24,8 +24,14 @@ const JoinOrganizationPage = () => {
const [error, setError] = useState<any>()
const [tokenValidationInfo, setTokenValidationInfo] = useState<TokenInfo>(undefined)
const [tokenInfoLoaded, setTokenInfoLoaded] = useState(false)
- const { token_does_not_exist, email_match, expired_token, organization_name, invite_id } =
- tokenValidationInfo || {}
+ const {
+ token_does_not_exist,
+ sso_mismatch,
+ email_match,
+ expired_token,
+ organization_name,
+ invite_id,
+ } = tokenValidationInfo || {}
const loginRedirectLink = `/?returnTo=${encodeURIComponent(`/join?token=${token}&slug=${slug}`)}`
@@ -93,6 +99,7 @@ const JoinOrganizationPage = () => {
const isError =
error ||
+ !!(tokenInfoLoaded && sso_mismatch) ||
!!(tokenInfoLoaded && token_does_not_exist) ||
(tokenInfoLoaded && !email_match) ||
(tokenInfoLoaded && expired_token)
@@ -111,6 +118,14 @@ const JoinOrganizationPage = () => {
const message = error ? (
<p>There was an error requesting details for this invitation. ({error.message})</p>
+ ) : sso_mismatch ? (
+ <>
+ <p>SSO providers do not match.</p>
+ <p className="text-foreground-lighter">
+ This invitation comes from a different identity provider than the one you are currently
+ logged in with. Please use the same SSO provider instead.
+ </p>
+ </>
) : token_does_not_exist ? (
<>
<p>The invite token is invalid.</p>
diff --git a/packages/api-types/types/api.d.ts b/packages/api-types/types/api.d.ts
index fa69d69e738..b338381e479 100644
--- a/packages/api-types/types/api.d.ts
+++ b/packages/api-types/types/api.d.ts
@@ -2679,6 +2679,7 @@ export interface components {
InviteResponse: {
organization_name: string
invite_id: string
+ sso_mismatch: boolean
token_does_not_exist: boolean
email_match: boolean
authorized_user: boolean