Some fixes
This commit is contained in:
parent
cc1c24718e
commit
67359e19b3
8 changed files with 51 additions and 44 deletions
10
auth.ts
10
auth.ts
|
|
@ -12,7 +12,7 @@ declare module 'next-auth' {
|
|||
|
||||
export const {
|
||||
handlers: { GET, POST },
|
||||
auth,
|
||||
auth
|
||||
} = NextAuth({
|
||||
providers: [GitHub],
|
||||
callbacks: {
|
||||
|
|
@ -23,6 +23,12 @@ export const {
|
|||
}
|
||||
return token
|
||||
},
|
||||
session: ({ session, token }) => {
|
||||
if (session?.user && token?.id) {
|
||||
session.user.id = String(token.id)
|
||||
}
|
||||
return session
|
||||
},
|
||||
authorized({ auth }) {
|
||||
return !!auth?.user // this ensures there is a logged in user for -every- request
|
||||
}
|
||||
|
|
@ -30,4 +36,4 @@ export const {
|
|||
pages: {
|
||||
signIn: '/sign-in' // overrides the next-auth default signin page https://authjs.dev/guides/basics/pages
|
||||
}
|
||||
})
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue