From 3772b12b1405009aecdcc23901145e808cb0350e Mon Sep 17 00:00:00 2001 From: r-freeman Date: Mon, 3 Apr 2023 23:09:57 +0100 Subject: [PATCH] Added next auth api route --- pages/api/auth/[...nextauth].ts | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 pages/api/auth/[...nextauth].ts diff --git a/pages/api/auth/[...nextauth].ts b/pages/api/auth/[...nextauth].ts new file mode 100644 index 0000000..b9ee78c --- /dev/null +++ b/pages/api/auth/[...nextauth].ts @@ -0,0 +1,18 @@ +import NextAuth from 'next-auth' +import GithubProvider from 'next-auth/providers/github' +import {PrismaAdapter} from '@next-auth/prisma-adapter' +import {PrismaClient} from '@prisma/client' + +const GITHUB_CLIENT_ID = process.env.GITHUB_CLIENT_ID ?? "" +const GITHUB_SECRET = process.env.GITHUB_SECRET ?? "" +const prisma = new PrismaClient() + +export default NextAuth({ + adapter: PrismaAdapter(prisma), + providers: [ + GithubProvider({ + clientId: GITHUB_CLIENT_ID, + clientSecret: GITHUB_SECRET + }) + ], +}) \ No newline at end of file