Sets a cookie with optional attributes.
Supports path, expires, secure, and sameSite.
path
expires
secure
sameSite
Cookie name.
Cookie value.
Optional cookie attributes.
Optional
setCookie("token", "abc123", { path: "/", expires: 7, secure: true, sameSite: "Strict" }); Copy
setCookie("token", "abc123", { path: "/", expires: 7, secure: true, sameSite: "Strict" });
1.2.0
Sets a cookie with optional attributes.
Supports
path
,expires
,secure
, andsameSite
.