# What does this PR do?


## Test Plan
This commit is contained in:
Eric Huang 2025-07-08 01:25:46 -07:00
parent 83c89265e0
commit 464b96cb09
23 changed files with 577 additions and 81 deletions

View file

@ -0,0 +1,38 @@
import { NextAuthOptions } from "next-auth";
import GithubProvider from "next-auth/providers/github";
export const authOptions: NextAuthOptions = {
providers: [
GithubProvider({
clientId: process.env.GITHUB_CLIENT_ID!,
clientSecret: process.env.GITHUB_CLIENT_SECRET!,
authorization: {
params: {
scope: "read:user user:email",
},
},
}),
],
debug: process.env.NODE_ENV === "development",
callbacks: {
async jwt({ token, account }) {
// Persist the OAuth access_token to the token right after signin
if (account) {
token.accessToken = account.access_token;
}
return token;
},
async session({ session, token }) {
// Send properties to the client, like an access_token from a provider.
session.accessToken = token.accessToken as string;
return session;
},
},
pages: {
signIn: "/auth/signin",
error: "/auth/signin", // Redirect errors to our custom page
},
session: {
strategy: "jwt",
},
};