ソースを参照

Update [...nextauth].ts

main
Steve Ruiz 4年前
コミット
0cb70f0df6
1個のファイルの変更8行の追加4行の削除
  1. 8
    4
      pages/api/auth/[...nextauth].ts

+ 8
- 4
pages/api/auth/[...nextauth].ts ファイルの表示

1
+import { NextApiRequest, NextApiResponse } from 'next'
1
 import NextAuth from 'next-auth'
2
 import NextAuth from 'next-auth'
2
 import Providers from 'next-auth/providers'
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
   providers: [
6
   providers: [
7
     Providers.GitHub({
7
     Providers.GitHub({
8
       clientId: process.env.GITHUB_ID,
8
       clientId: process.env.GITHUB_ID,
10
     }),
10
     }),
11
   ],
11
   ],
12
   callbacks: {
12
   callbacks: {
13
-    async redirect(url, baseUrl) {
13
+    async redirect(url: string, baseUrl: string) {
14
       return url.startsWith(baseUrl) ? url : baseUrl
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
+}

読み込み中…
キャンセル
保存