问题描述
我有一个由 express 发送的 http-only cookie。它运行良好,但我注销时无法删除它。
代码是:
require("dotenv").config();
import { Response,Request } from "express";
const logout = async (req: Request,res: Response): Promise<Response> => {
try {
return res.clearCookie("myapp",{ domain: process.env.CLIENT,path: "/" });
} catch (err) {
res.status(409).json({ message: "error.unkNown" });
}
};
export default logout;
cookie 是这样创建的:
return res
.status(200)
.cookie("myapp",token,{
expires: new Date(Date.Now() + msPerDay * 14),httpOnly: true,})
.json({ user });
如何解决这个问题?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)