Skip to content

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

fix: create new page to handle gotrue callback

phamhieu825d82322b06
diff --git a/studio/pages/callback.tsx b/studio/pages/callback.tsx
new file mode 100644
index 00000000000..e9537707a5b
--- /dev/null
+++ b/studio/pages/callback.tsx
@@ -0,0 +1,43 @@
+import Head from 'next/head'
+import { NextPage } from 'next'
+import { useEffect } from 'react'
+import { useRouter } from 'next/router'
+import Connecting from 'components/ui/Loading'
+import { auth } from 'lib/gotrue'
+
+const AuthCallback: NextPage = () => {
+ const router = useRouter()
+
+ useEffect(() => {
+ auth.onAuthStateChange((event) => {
+ if (event == 'SIGNED_IN') {
+ router.push('/')
+ }
+ })
+
+ // 5 seconds timeout
+ const timer = setTimeout(() => {
+ router.push('/')
+ }, 5000)
+ return () => clearTimeout(timer)
+ }, [])
+
+ return (
+ <>
+ <Head>
+ <title>Supabase</title>
+ <meta name="description" content="Supabase Studio" />
+ <link rel="icon" href="/favicon.ico" />
+ </Head>
+ <div className="flex h-full">
+ <main
+ style={{ maxHeight: '100vh' }}
+ className="w-full flex flex-col flex-1 overflow-y-auto"
+ >
+ <Connecting />
+ </main>
+ </div>
+ </>
+ )
+}
+export default AuthCallback