-
And if so, how do I access them? I have set up two middlewares like so: /**
* Add session middleware (https://github.com/sergiodxa/remix-hono?tab=readme-ov-file#session-management)
*/
app.use(
// @ts-expect-error - FIXME: require next remix-hono version
session({
autoCommit: true,
createSessionStorage(c) {
const env = typedEnv(c, envSchema);
if (!env.SESSION_SECRET) {
throw new Error('SESSION_SECRET is not defined');
}
const sessionStorage = createCookieSessionStorage({
cookie: {
name: 'session',
httpOnly: true,
path: '/',
sameSite: 'lax',
secrets: [env.SESSION_SECRET],
secure: env.NODE_ENV === 'production',
},
});
return {
...sessionStorage,
// If a user doesn't come back to the app within 30 days, their session will be deleted.
async commitSession(session) {
return sessionStorage.commitSession(session, {
maxAge: 60 * 60 * 24 * 30, // 30 days
});
},
};
},
}),
);
app.use(
// @ts-expect-error - FIXME: require next remix-hono version
session({
autoCommit: true,
createSessionStorage(c) {
const env = typedEnv(c, envSchema);
if (!env.SESSION_SECRET) {
throw new Error('SESSION_SECRET is not defined');
}
const sessionStorage = createCookieSessionStorage({
cookie: {
name: 'theme',
httpOnly: true,
path: '/',
sameSite: 'lax',
secrets: [env.SESSION_SECRET],
secure: env.NODE_ENV === 'production',
},
});
return {
...sessionStorage,
// If a user doesn't come back to the app within 30 days, their session will be deleted.
async commitSession(session) {
return sessionStorage.commitSession(session, {
maxAge: 60 * 60 * 24 * 30, // 30 days
});
},
};
},
}),
); and I can see the two cookies in the dev tools. But calling |
Beta Was this translation helpful? Give feedback.
Answered by
sergiodxa
Mar 7, 2024
Replies: 1 comment 3 replies
-
You can’t, but why not use one session? |
Beta Was this translation helpful? Give feedback.
3 replies
Answer selected by
cill-i-am
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You can’t, but why not use one session?
I usually just use one session or one session and many other cookies.