mirror of
https://github.com/r-freeman/portfolio.git
synced 2025-05-03 20:20:21 +00:00
All checks were successful
Build And Publish / BuildAndPublish (push) Successful in 3m8s
31 lines
825 B
TypeScript
31 lines
825 B
TypeScript
import NextAuth from 'next-auth'
|
|
import GitHub from 'next-auth/providers/github'
|
|
|
|
export const {handlers, signIn, signOut, auth} = NextAuth({
|
|
providers: [
|
|
GitHub({
|
|
clientId: process.env.GITHUB_CLIENT_ID,
|
|
clientSecret: process.env.GITHUB_SECRET
|
|
})
|
|
],
|
|
callbacks: {
|
|
async redirect({url, baseUrl}) {
|
|
return url
|
|
},
|
|
async jwt({token, user, account, profile}) {
|
|
if (profile) {
|
|
token.profile = profile
|
|
}
|
|
return token
|
|
},
|
|
async session({session, user, token}) {
|
|
if (token.profile) {
|
|
session.user = {
|
|
...session.user,
|
|
...token.profile
|
|
}
|
|
}
|
|
return session
|
|
}
|
|
}
|
|
}) |