import jwt from 'jsonwebtoken'; import { CookieOptions, Response } from 'express'; import { JwtSecret } from '../config/env'; const generateToken = (res: Response, payload: MyPayload) => { const token = jwt.sign(payload, JwtSecret); // options for cookies const options: CookieOptions = { sameSite: 'none', httpOnly: true, expires: new Date(new Date().getTime() + 720000000), secure : true, }; res.cookie('token', token, options); }; export default generateToken;