Custom Signup page
Course: Next Auth - chapter 9
What if you want to change how your signup page looks
-
Add
pagesto next auth Ref - https://github.com/code100x/cms/blob/main/src/lib/auth.ts#L207 -
Add
app/signin/page.tsxRef - https://github.com/code100x/cms/blob/main/src/app/signin/page.tsx Ref - https://github.com/code100x/cms/blob/main/src/components/Signin.tsx#L39
"use client"import { signIn } from 'next-auth/react';import { useRouter } from 'next/navigation';
export default function() { const router = useRouter();
return <div> <button onClick={async () => { await signIn("google"); }}>Login with google</button>
<br /> <button onClick={async () => { await signIn("github"); }}>Login with Github</button> <br /> <button onClick={async () => { const res = await signIn("credentials", { username: "", password: "", redirect: false, }); console.log(res); router.push("/") }}>Login with email</button>
</div>}Final code -