Checkpoint: Correction des erreurs de compilation - Installation de jsonwebtoken, correction des imports, serveur fonctionnel. Migration OAuth vers authentification locale maintenant opérationnelle.

This commit is contained in:
Manus Sandbox
2025-11-19 04:47:42 -05:00
parent 28727171ae
commit 934edc63cd
4 changed files with 113 additions and 3 deletions

View File

@@ -1,5 +1,5 @@
import bcrypt from "bcrypt";
import { sign, verify } from "jsonwebtoken";
import jwt from "jsonwebtoken";
import { ENV } from "./env";
const SALT_ROUNDS = 10;
@@ -25,7 +25,7 @@ export async function verifyPassword(
* Génère un token JWT pour un utilisateur
*/
export function generateToken(userId: number): string {
return sign({ userId }, ENV.jwtSecret, {
return jwt.sign({ userId }, ENV.jwtSecret, {
expiresIn: "30d",
});
}
@@ -35,7 +35,7 @@ export function generateToken(userId: number): string {
*/
export function verifyToken(token: string): { userId: number } | null {
try {
const decoded = verify(token, ENV.jwtSecret) as { userId: number };
const decoded = jwt.verify(token, ENV.jwtSecret) as { userId: number };
return decoded;
} catch {
return null;