Implement next-auth v5
This commit is contained in:
parent
a9e4956909
commit
187b55aad7
15 changed files with 420 additions and 547 deletions
23
auth.ts
Normal file
23
auth.ts
Normal 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'
|
||||
}
|
||||
})
|
||||
Loading…
Add table
Add a link
Reference in a new issue