import { decode } from "next-auth/jwt"; const cookieName = "__Secure-next-auth.session-token"; const token = request.cookies.get(cookieName)?.value; const currentUrl = request.nextUrl.pathname; if (!token) return NextResponse.redirect(new URL("/login", request.url)); const decryptedToken = (await decode({ token, secret: env.NEXTAUTH_SECRET!, })) as unknown as Session["user"];