complete login with password controller and services

This commit is contained in:
rafiarrafif
2025-05-11 19:50:45 +07:00
parent 7adda16a6b
commit ed8840ee1f
7 changed files with 50 additions and 6 deletions

View File

@ -0,0 +1,11 @@
import jwt from "jsonwebtoken";
export const jwtEncode = (payload: any) => {
const tokenLifetime = Number(process.env.SESSION_EXPIRE!);
const jwtSecret = process.env.JWT_SECRET!;
const jwtToken = jwt.sign(payload, jwtSecret, {
expiresIn: tokenLifetime,
});
return jwtToken;
};