mirror of
https://github.com/supabase/supabase.git
synced 2026-06-03 03:11:35 +08:00
The end of the Great Migration is here!!! Moves the last pages over, deleting pages like the FAQ that we don't use and that contain duplicated information anyway. Dev secret auth page URL had to change as App Router doesn't like the leading underscores in the path. Also fixes the not-found recommendations to use the proper Next.js not-found page so it will return a 404 as it should. (I was under the erroneous impression that I couldn't get the pathname in not-found.tsx, that is not true, so this works better.)
52 lines
1.3 KiB
TypeScript
52 lines
1.3 KiB
TypeScript
'use client'
|
|
|
|
import { useRouter } from 'next/navigation'
|
|
|
|
import { Button_Shadcn_ } from 'ui'
|
|
|
|
import { auth } from '~/lib/userAuth'
|
|
|
|
export function DevSecretAuthForm() {
|
|
const router = useRouter()
|
|
|
|
function signInWithGitHub() {
|
|
auth.signInWithOAuth({
|
|
provider: 'github',
|
|
options: {
|
|
redirectTo: process.env.NEXT_PUBLIC_SITE_URL,
|
|
},
|
|
})
|
|
}
|
|
|
|
function signOut() {
|
|
auth.signOut().then(({ error }) => {
|
|
if (error) {
|
|
throw error
|
|
}
|
|
|
|
router.push('/')
|
|
})
|
|
}
|
|
|
|
return (
|
|
<div className="p-10 flex items-center justify-center max-w-lg mx-auto">
|
|
<section className="space-y-4">
|
|
<h1>Sign in</h1>
|
|
<p>
|
|
This is a dev-only route to sign in and test authenticated actions within docs. In staging
|
|
and production, signin is managed via dashboard because docs and dashboard are proxied to
|
|
the same domain.
|
|
</p>
|
|
<form className="flex flex-col gap-2 max-w-sm">
|
|
<Button_Shadcn_ type="button" variant="default" onClick={signInWithGitHub}>
|
|
Sign in with GitHub
|
|
</Button_Shadcn_>
|
|
<Button_Shadcn_ type="button" variant="outline" onClick={signOut}>
|
|
Sign out
|
|
</Button_Shadcn_>
|
|
</form>
|
|
</section>
|
|
</div>
|
|
)
|
|
}
|