The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
[FE-3483] fix(studio): redirect OAuth callback errors to /sign-in (#46414)
Alaister Youngd6835c4b4270
diff --git a/apps/studio/components/interfaces/SignIn/SignInForm.tsx b/apps/studio/components/interfaces/SignIn/SignInForm.tsxindex ee860f4d3df..e6cf1f63cfe 100644--- a/apps/studio/components/interfaces/SignIn/SignInForm.tsx+++ b/apps/studio/components/interfaces/SignIn/SignInForm.tsx@@ -2,6 +2,7 @@ import HCaptcha from '@hcaptcha/react-hcaptcha'import { zodResolver } from '@hookform/resolvers/zod'import type { AuthError } from '@supabase/supabase-js'import { useQueryClient } from '@tanstack/react-query'+import { useAuthError } from 'common'import { Eye, EyeOff } from 'lucide-react'import Link from 'next/link'import { useRouter } from 'next/router'@@ -13,6 +14,7 @@ import { FormItemLayout } from 'ui-patterns/form/FormItemLayout/FormItemLayout'import z from 'zod'import { LastSignInWrapper } from './LastSignInWrapper'+import AlertError from '@/components/ui/AlertError'import { useAddLoginEvent } from '@/data/misc/audit-login-mutation'import { getMfaAuthenticatorAssuranceLevel } from '@/data/profile/mfa-authenticator-assurance-level-query'import { useLastSignIn } from '@/hooks/misc/useLastSignIn'@@ -115,9 +117,12 @@ export const SignInForm = () => {}}+ const authError = useAuthError()+return (<Form {...form}><form id={formId} className="flex flex-col gap-4" onSubmit={form.handleSubmit(onSubmit)}>+ {authError && <AlertError error={authError} subject="Error while signing in" />}<FormFieldkey="email"name="email"diff --git a/apps/studio/pages/sign-in-mfa.tsx b/apps/studio/pages/sign-in-mfa.tsxindex ed1a2edd495..8a68bfad43c 100644--- a/apps/studio/pages/sign-in-mfa.tsx+++ b/apps/studio/pages/sign-in-mfa.tsx@@ -42,9 +42,10 @@ const SignInMfaPage: NextPageWithLayout = () => {.initialize().then(async ({ error }) => {if (error) {- // if there was a problem signing in via the url, don't redirect- setLoading(false)- return+ // OAuth/SSO callback failed — bounce back to /sign-in so the error renders under the+ // correct heading instead of "Two-factor authentication". The error is held in the+ // shared auth context and surfaces via useAuthError() on /sign-in.+ return router.replace({ pathname: '/sign-in', query: router.query })}const token = await getAccessToken()