Git Product home page Git Product logo

Comments (2)

WillKoste avatar WillKoste commented on July 2, 2024 6

@AaronMcCloskey I've been debugging this issue for a few hours now and I think I finally got it. In the Express docs, it states that the clearCookie options have to be identical to the options passed in for the express-session middleware on ./server/src/index.ts.
clearCookieDocs

Chrome has been giving me issues, but here are the options I passed in for the middleware:

app.use(
			session({
				name: COOKIE_NAME,
				secret: SESSION_SECRET,
				store: new RedisStore({client: redis, disableTouch: true}),
				cookie: {
					maxAge: 1000 * 60 * 60 * 24 * 365 * 10, // 10 years
					secure: true,
					sameSite: 'none'
				},
				saveUninitialized: false,
				resave: false
			})
		);

And here is the clearCookie:

@Mutation(() => Boolean)
	logout(@Ctx() {req, res}: MyContext) {
		return new Promise((resolve) =>
			req.session.destroy((err) => {
				res.clearCookie(COOKIE_NAME, {
					secure: true,
					sameSite: 'none'
				});
				if (err) {
					console.error(err);
					resolve(false);
					return;
				}
				resolve(true);
			})
		);
	}

Hopefully, this helps- I hate debugging cookies...

from lireddit.

WillKoste avatar WillKoste commented on July 2, 2024

Oh, and it would also be good to mention that I am just using React, not Next.js.

from lireddit.

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.