From 24c37ab86ffb602ec7efd87982792dd946ebbee3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A1niel=20K?= <51174697+DanCodernaut@users.noreply.github.com> Date: Mon, 2 Jun 2025 18:30:58 +0200 Subject: [PATCH] fix(env): fix environment variable usage for JWT_EXPIRES_IN in auth route --- app/api/auth/sign-in/route.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/api/auth/sign-in/route.ts b/app/api/auth/sign-in/route.ts index b70f2dd..e31a3a4 100644 --- a/app/api/auth/sign-in/route.ts +++ b/app/api/auth/sign-in/route.ts @@ -1,4 +1,3 @@ -import { JWT_EXPIRES_IN } from "@/config/env"; import connectDB from "@/lib/db"; import User from "@/lib/models/user"; import * as jwt from "jsonwebtoken"; @@ -45,7 +44,9 @@ export async function POST(request: NextRequest): Promise { throw new Error("JWT_SECRET is not defined"); } - const token = jwt.sign({ id: user._id }, JWT_SECRET, { expiresIn: JWT_EXPIRES_IN || "2d" }); + const token = jwt.sign({ id: user._id }, JWT_SECRET, { + expiresIn: process.env.JWT_EXPIRES_IN || "2d", + }); // Create response const response = NextResponse.json({