This commit is contained in:
Patryk Koreń
2026-07-09 21:11:29 +02:00
parent 65303e655b
commit fa9e3b5ce7
10 changed files with 188 additions and 13 deletions

View File

@@ -4,13 +4,9 @@ import type { Request, Response, NextFunction } from "express";
export function authMiddleware(req: Request, res: Response, next: NextFunction) {
try {
const token = req.cookies.token;
if (!token) { return res.sendStatus(401); }
console.log("Token: ", token)
console.log("Secret: ", process.env.JWT_SECRET)
jwt.verify(token, process.env.JWT_SECRET!)
next();
} catch {