Skip to content

Instantly share code, notes, and snippets.

@balazsorban44
Created December 7, 2022 13:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save balazsorban44/6e7f66791afdd0888925c2c2bcf618d8 to your computer and use it in GitHub Desktop.
Save balazsorban44/6e7f66791afdd0888925c2c2bcf618d8 to your computer and use it in GitHub Desktop.
import NextAuth, { NextAuthOptions } from "next-auth"
import GithubProvider from "next-auth/providers/github"
export const authOptions: NextAuthOptions = {
providers: [
GithubProvider({
clientId: process.env.GITHUB_ID,
clientSecret: process.env.GITHUB_SECRET,
}),
],
callbacks: {
jwt({ token, profile }) {
if (profile) token.id = profile.id
return token
},
async session({ session, token }) {
session.id = token.id
return session
},
},
}
export default NextAuth(authOptions)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment