import { createCookieSessionStorage } from "remix";
const sessionSecret = "YOURSESSIONSECRET";
const { getSession, commitSession, destroySession } =
createCookieSessionStorage({
// a Cookie from `createCookie` or the CookieOptions to create one
cookie: {
name: "__session",
// all of these are optional
domain: "domain.tld",
expires: new Date(Date.now() + 60),
httpOnly: true,
maxAge: 60,
path: "/",
sameSite: "lax",
secrets: [sessionSecret],
secure: true
}
});
export { getSession, commitSession, destroySession };
Create Cookie Session
Create a cookie session with remix.
Shortcut: remix.cookie.session
0 Comments
Add Comment
Log in to add a comment