Update next-auth
This commit is contained in:
parent
187b55aad7
commit
fef709a21d
6 changed files with 28 additions and 10 deletions
7
auth.ts
7
auth.ts
|
|
@ -5,16 +5,23 @@ export const {
|
|||
handlers: { GET, POST },
|
||||
auth,
|
||||
CSRF_experimental
|
||||
// @ts-ignore
|
||||
} = NextAuth({
|
||||
// @ts-ignore
|
||||
providers: [GitHub],
|
||||
callbacks: {
|
||||
// @ts-ignore
|
||||
jwt: async ({ token, profile }) => {
|
||||
if (profile?.id) {
|
||||
token.id = profile.id
|
||||
token.image = profile.picture
|
||||
}
|
||||
return token
|
||||
},
|
||||
// @ts-ignore
|
||||
authorized({ request, auth }) {
|
||||
if (!request.nextUrl.pathname.startsWith('/share/')) return true
|
||||
return !!auth?.user
|
||||
}
|
||||
},
|
||||
pages: {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue