tldraw/pages/api/auth/[...nextauth].ts
2021-06-19 19:58:52 +01:00

21 lines
531 B
TypeScript

import { NextApiRequest, NextApiResponse } from 'next'
import NextAuth from 'next-auth'
import Providers from 'next-auth/providers'
const options = {
providers: [
Providers.GitHub({
clientId: process.env.GITHUB_ID,
clientSecret: process.env.GITHUB_SECRET,
}),
],
callbacks: {
async redirect(url: string, baseUrl: string) {
return url.startsWith(baseUrl) ? url : baseUrl
},
},
}
export default function (req: NextApiRequest, res: NextApiResponse) {
return NextAuth(req, res, options)
}