GithubHelp home page GithubHelp logo

Comments (7)

tbrasington avatar tbrasington commented on April 25, 2024

I did a bit of debugging, if you remove the maxAge on the initialiser for createCookieStorage, the problem goes away

export const sessionStorage = createCookieSessionStorage({
  cookie: {
    name: "__session",
    httpOnly: true,
   // maxAge: 0,
    path: "/",
    sameSite: "lax",
    secrets: [process.env.SESSION_SECRET],
    secure: process.env.NODE_ENV === "production",
  },
});

from blues-stack.

kentcdodds avatar kentcdodds commented on April 25, 2024

Hi @tbrasington,

Ah, that maxAge is set to 0 because we set this up so the "Remember Me" checkbox would work. If you don't check it then the session lasts only as long as the browser session (so until they close the tab) and if you check it then we set it to 7 days: https://github.com/tbrasington/remix-flash-test/blob/6dd74dfbba3420d00d3ca3b98e92955b4fcdfb9c/app/session.server.ts#L84

Feel free to change that behavior in your app.

from blues-stack.

tbrasington avatar tbrasington commented on April 25, 2024

Hi @kentcdodds thank you for the clarification. Is it then possible to have functionality like remember me and flash messages use cookie session storage?

from blues-stack.

ryanflorence avatar ryanflorence commented on April 25, 2024

Yes, the messages will only last as long as the browser session if you use the same session for messages and auth.

You can split them up into two sessions, but it would be weird to have messages survive longer than the session while auth does not.

As for your issue, it doesn't make sense to me that the session expires by setting a new value in it. Even with a maxAge of 0, you should be able to update values in the session (otherwise it's not really a session at all).

from blues-stack.

kentcdodds avatar kentcdodds commented on April 25, 2024

@ryanflorence so are you saying this is a Remix bug?

from blues-stack.

zayenz avatar zayenz commented on April 25, 2024

I had the same issue with a blues stack app when adding a CSFR token (using https://github.com/sergiodxa/remix-utils#csrf).

from blues-stack.

mcansh avatar mcansh commented on April 25, 2024

removing / not setting a maxAge makes the cookie a sessionOnly cookie by default and has since been removed #85

from blues-stack.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.