Codepilot uses NextAuth to authenticate users. You can configure it in the /app/api/auth/[...nextauth]/route.ts file.
There are multiple built-in ways to authenticate users with Codepilot: Credentials, Magic Link & OAuthProvider(Google, Twitter, Github): .
AthButton.ts
const AuthButton = ({ onClick, content, icon }: AuthButtonProps) => {
return (
<button
className="flex justify-center items-center duration-150 ease-in-out gap-2 px-5 py-3 w-full border border-grey-300 rounded-lg bg-white text-black
hover:bg-grey-200
focus:bg-white
dark:hover:bg-input-hover-dark
dark:bg-input-dark
dark:border-input-border-dark
focus:shadow-focus-primary
"
onClick={onClick}
type="button"
>
{icon}
<p className='text-black dark:text-grey-200 text-sm leading-5 font-medium '>{content}</p>
</button>
)
}
export default AuthButton;
Example Usage of AuthButton.ts can be found in the /app/(auth)/login/page.tsx file.
<AuthButton onClick={() => { signIn('google', { callbackUrl: `/dashboard` }) }} content={t("loginPage.signWithGoogle")} icon={<GoogleIcon />} />