Skip to main content

Describes the cookie to set.

Properties (9)

Property Type Default Required Description
domain⚓︎ string x x

Domain for the cookie. Will be normalized with a preceding dot in order to be valid for subdomains too.

expirationDate⚓︎ number x x

The expiration date of the cookie as a number of seconds since the UNIX epoch. If not specified, the cookie will become a session cookie and won't be persisted between sessions.

httpOnly⚓︎ boolean false x

If true, the cookie will be marked with an HttpOnly attribute.

name⚓︎ string x x

Name for the cookie.

path⚓︎ string x x

Path for the cookie.

sameSite⚓︎ ("unspecified" | "no_restriction" | "lax" | "strict") "lax" x

The value to be applied to the SameSite attribute. If set to "no_restriction", the secure property will be automatically set to true.

secure⚓︎ boolean false x

If true, the cookie will be marked with a Secure attribute. Default is false, unless the SameSite attribute has been set to None.

url⚓︎ string x

URL to associate with the cookie.

value⚓︎ string x x

Value for the cookie.