From 0cb70f0df6523ec8bd30815b1edd7c4ac813fd39 Mon Sep 17 00:00:00 2001 From: Steve Ruiz Date: Sat, 19 Jun 2021 15:48:45 +0100 Subject: [PATCH] Update [...nextauth].ts --- pages/api/auth/[...nextauth].ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/pages/api/auth/[...nextauth].ts b/pages/api/auth/[...nextauth].ts index 070311bd2..ceb91a7b2 100644 --- a/pages/api/auth/[...nextauth].ts +++ b/pages/api/auth/[...nextauth].ts @@ -1,8 +1,8 @@ +import { NextApiRequest, NextApiResponse } from 'next' import NextAuth from 'next-auth' import Providers from 'next-auth/providers' -import { redirect } from 'next/dist/next-server/server/api-utils' -export default NextAuth({ +const options = { providers: [ Providers.GitHub({ clientId: process.env.GITHUB_ID, @@ -10,8 +10,12 @@ export default NextAuth({ }), ], callbacks: { - async redirect(url, baseUrl) { + async redirect(url: string, baseUrl: string) { return url.startsWith(baseUrl) ? url : baseUrl }, }, -}) +} + +export default function (req: NextApiRequest, res: NextApiResponse) { + return NextAuth(req, res, options) +}