Implement next-auth v5

This commit is contained in:
Jared Palmer 2023-06-16 11:49:14 -04:00
parent a9e4956909
commit 187b55aad7
15 changed files with 420 additions and 547 deletions

23
auth.ts Normal file
View file

@ -0,0 +1,23 @@
import NextAuth from 'next-auth'
import GitHub from 'next-auth/providers/github'
export const {
handlers: { GET, POST },
auth,
CSRF_experimental
} = NextAuth({
// @ts-ignore
providers: [GitHub],
callbacks: {
jwt: async ({ token, profile }) => {
if (profile?.id) {
token.id = profile.id
token.image = profile.picture
}
return token
}
},
pages: {
signIn: '/sign-in'
}
})