+2. **Cookie:** Configuring `setCookieStore(name: string, opts?: object)` adds support for cookie-backed persistence. This is useful for applications that rely on server-side rendering, but also requires the application to implement CSRF protection mechanisms. By passing an additional object to `setCookieStore(...)` it is also possible to configure the cookies path and SameSite attributes, along with whether an explicit expiration is written for the cookie. For example, `setCookieStore("authn-token", {path: "/admin", sameSite: "Strict", useExplicitExpiry: true })` will restrict the cookie to `/admin` with an explicit expiration derived from the session's `exp` claim and exclude it from third-party top-level navigations. If `sameSite` is not provided the browser will choose it's default value. If `useExplicitExpiry` is not provided default behavior is to write a session cookie.
0 commit comments