In the frontend it's as simple as...
import { signIn } from "next-auth/react";
<button
onClick={() => signIn("google", { callbackUrl: "/account" })}
>
Sign in
</Button>
And your api/auth/[...nextauth].ts
route stays the same, no extra configuration needed:
const options = {
providers: [
GoogleProvider({
clientId: process.env.GOOGLE_OAUTH_CLIENT_ID,
clientSecret: process.env.GOOGLE_OAUTH_CLIENT_SECRET,
}),
],
adapter: PrismaAdapter(prisma),
secret: process.env.SECRET,
};
const authHandler: NextApiHandler = (req, res) => NextAuth(req, res, options);
export default authHandler;
Top comments (0)