Skip to content

Custom Signup page

Course: Next Auth - chapter 9

What if you want to change how your signup page looks

  1. Add pages to next auth Ref - https://github.com/code100x/cms/blob/main/src/lib/auth.ts#L207

  2. Add app/signin/page.tsx Ref - 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 -

https://github.com/100xdevs-cohort-2/week-16-live-4