Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/lib/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,10 @@ async function validateUser(
data: null,
};
}
// check if the secret exists if not throw a new error
if (!process.env.NEXTAUTH_SECRET) {
throw new Error("NEXTAUTH_SECRET is not defined");
}

export const authOptions = {
providers: [
Expand Down Expand Up @@ -223,7 +227,7 @@ export const authOptions = {
},
}),
],
secret: process.env.NEXTAUTH_SECRET || 'secr3t',
secret: process.env.NEXTAUTH_SECRET, // we have already checked for the secret so does not need to or some string
callbacks: {
session: async ({ session, token }) => {
const newSession: session = session as session;
Expand Down