import { useRouter } from 'next/compat/router' import { Button_Shadcn_ } from 'ui' import { auth } from '~/lib/userAuth' export function getServerSideProps() { if (process.env.NEXT_PUBLIC_DEV_AUTH_PAGE === 'true') { return { props: {}, } } return { notFound: true, } } export default function DevOnlySecretAuth() { 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 (
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.