buildJwtTokenCookie function
Builds an HTTP-only JWT cookie.
Implementation
Cookie buildJwtTokenCookie(
String cookieName,
String token, {
DateTime? expires,
String path = '/',
bool httpOnly = true,
bool secure = true,
SameSite sameSite = SameSite.lax,
}) {
final cookie = Cookie(cookieName, token)
..httpOnly = httpOnly
..path = path
..secure = secure
..sameSite = sameSite;
if (expires != null) {
cookie.expires = expires;
}
return cookie;
}