Update [...nextauth].ts
This commit is contained in:
parent
01fc6f5723
commit
0cb70f0df6
1 changed files with 8 additions and 4 deletions
|
@ -1,8 +1,8 @@
|
||||||
|
import { NextApiRequest, NextApiResponse } from 'next'
|
||||||
import NextAuth from 'next-auth'
|
import NextAuth from 'next-auth'
|
||||||
import Providers from 'next-auth/providers'
|
import Providers from 'next-auth/providers'
|
||||||
import { redirect } from 'next/dist/next-server/server/api-utils'
|
|
||||||
|
|
||||||
export default NextAuth({
|
const options = {
|
||||||
providers: [
|
providers: [
|
||||||
Providers.GitHub({
|
Providers.GitHub({
|
||||||
clientId: process.env.GITHUB_ID,
|
clientId: process.env.GITHUB_ID,
|
||||||
|
@ -10,8 +10,12 @@ export default NextAuth({
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
callbacks: {
|
callbacks: {
|
||||||
async redirect(url, baseUrl) {
|
async redirect(url: string, baseUrl: string) {
|
||||||
return url.startsWith(baseUrl) ? url : baseUrl
|
return url.startsWith(baseUrl) ? url : baseUrl
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
})
|
}
|
||||||
|
|
||||||
|
export default function (req: NextApiRequest, res: NextApiResponse) {
|
||||||
|
return NextAuth(req, res, options)
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue