Skip to content

Commit

Permalink
Comment suggestions for auth.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
swyxio authored Jul 5, 2023
1 parent bd4fc24 commit ced218b
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions auth.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import NextAuth, { type DefaultSession } from 'next-auth'
import GitHub from 'next-auth/providers/github'
import { NextResponse } from 'next/server'

declare module 'next-auth' {
interface Session {
Expand All @@ -14,7 +13,7 @@ declare module 'next-auth' {
export const {
handlers: { GET, POST },
auth,
CSRF_experimental
CSRF_experimental // will be removed in future
} = NextAuth({
providers: [GitHub],
callbacks: {
Expand All @@ -26,10 +25,10 @@ export const {
return token
},
authorized({ auth }) {
return !!auth?.user
return !!auth?.user // this ensures there is a logged in user for -every- request
}
},
pages: {
signIn: '/sign-in'
signIn: '/sign-in' // overrides the next-auth default signin page https://authjs.dev/guides/basics/pages
}
})

0 comments on commit ced218b

Please sign in to comment.