Closed Darkside73 closed 1 year ago
All tests below work. If not in an iFrame BY DEFAULT - CodeSandbox: need to be opened in its own window to work.
This can be mitigated by changing the plugin's config (a note about it, should probably be added to readme):
export default defineNuxtConfig({
modules: ["@sidebase/nuxt-session"],
session: {
session: {
// allows to work in an iframe, and anywhere
cookieSameSite: "none", // default is "lax"
cookieSecure: true,
},
},
});
Tests:
let z = await fetch('/api/foo', {
method: 'GET',
credentials: 'include'
}).then(d => d.json());
console.log('/foo JSON', z);
let x = await fetch('/api/session', {
method: 'GET',
credentials: 'include'
}).then(d => d.json())
console.log('SESSION JSON', x); // {id: ...
let y = await useFetch("/api/session");
console.log("/api/session 1", y.data.value.id);
y = await useFetch("/api/session");
console.log("/api/session 2", y.data.value.id);
testing here: https://codesandbox.io/p/sandbox/template-for-nuxt3-vue3-typescript-jsx-pug-less-sass-sessions-qttdx0
Thanks. The issue was in outdated dependencies (nuxt itself I think)
@Darkside73 How do you feel about This can be mitigated by changing the plugin's config (a note about it, should probably be added to readme):
?
Ask your question
After installing module I get different session ids (and essentially separate sessions) for each API request
Server stdout
Each request generates new session id. Is it possible achieve single session?
Additional information
No response