|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+import { NextApiRequest, NextApiResponse } from 'next'
|
|
1
|
2
|
import NextAuth from 'next-auth'
|
|
2
|
3
|
import Providers from 'next-auth/providers'
|
|
3
|
|
-import { redirect } from 'next/dist/next-server/server/api-utils'
|
|
4
|
4
|
|
|
5
|
|
-export default NextAuth({
|
|
|
5
|
+const options = {
|
|
6
|
6
|
providers: [
|
|
7
|
7
|
Providers.GitHub({
|
|
8
|
8
|
clientId: process.env.GITHUB_ID,
|
|
|
@@ -10,8 +10,12 @@ export default NextAuth({
|
|
10
|
10
|
}),
|
|
11
|
11
|
],
|
|
12
|
12
|
callbacks: {
|
|
13
|
|
- async redirect(url, baseUrl) {
|
|
|
13
|
+ async redirect(url: string, baseUrl: string) {
|
|
14
|
14
|
return url.startsWith(baseUrl) ? url : baseUrl
|
|
15
|
15
|
},
|
|
16
|
16
|
},
|
|
17
|
|
-})
|
|
|
17
|
+}
|
|
|
18
|
+
|
|
|
19
|
+export default function (req: NextApiRequest, res: NextApiResponse) {
|
|
|
20
|
+ return NextAuth(req, res, options)
|
|
|
21
|
+}
|