title: Unable to read cookies from browser after passport google login
body: <p>I am trying to implement a ReactJS application that runs with a Node.JS with express and I am using PassportJS google oauth20 for the authentication.</p>
  
  <p>The authentication part going without any problems and when I open my chrome dev tools I can see that I have 2 cookies injected after the auth, the problem is that when i try to get them with <code>react-cookie</code> or <code>js-cookie</code> or event with <code>document.cookie</code> nothing comes back</p>
  
  <p>The App for Express is based on the express generator
  App: </p>
  
  <pre><code>var createError = require('http-errors');
  var express = require('express');
  var path = require('path');
  var cookieParser = require('cookie-parser');
  var logger = require('morgan');
  var passport = require('passport');
  const passportSetup = require('./config/passport');
  const cookieSession = require('cookie-session');
  
  // some router imports here
  var app = express();
  // view engine setup
  app.set('views', path.join(__dirname, 'views'));
  app.set('view engine', 'jade');
  
  /
  
  app.use(cookieSession({
    maxAge: 60 * 60 * 1000,
    keys: ['mysuperseacretcat']
  }));
  
  app.use(passport.initialize());
  app.use(passport.session());
  
  app.use('/', indexRouter);
  app.use('/auth', authRouter);
  app.use('/users', usersRouter);
  app.use('/orders', ordersRouter);
  app.use('/orderdetails', orderDetailsRouter);
  app.use('/suppliers', suppliersRouter);
  
  
  // catch 404 and forward to error handler
  app.use(function (req, res, next) {
    next(createError(404));
  });
  
  // error handler
  app.use(function (err, req, res, next) {
    // set locals, only providing error in development
    res.locals.message = err.message;
    res.locals.error = req.app.get('env') === 'development' ? err : {};
  
    // render the error page
    res.status(err.status || 500);
    res.render('error');
  });
  
  
  app.get("*", function(req, res) {
    res.sendFile(path.join(__dirname, "client/build", "index.html"));
  });
  
  module.exports = app;
  </code></pre>
  
  <p>Passport config : </p>
  
  <pre><code>const passport = require("passport");
  const GoogleStrategy = require("passport-google-oauth20");
  
  passport.serializeUser((user, done) =&gt; {
    done(null, user.id);
  });
  
  passport.deserializeUser((id, done) =&gt; {
    done(null, id);
  });
  
  passport.use(
    new GoogleStrategy(
      {
        callbackURL: "/auth/google/redirect",
        clientID: "ENV",
        clientSecret: "ENV"
      },
      (accessToken, refreshToken, profile, done) =&gt; {
        if (profile._json.email.split('@')[1] !== 'xxx' || profile._json.hd !== 'xxx') {
          done(null, false);
        } else {
          done(null, profile)
        }
      }
    )
  );
  </code></pre>
  
  <p>Google Auth Routes: </p>
  
  <pre><code>router.get(
    "/google", passport.authenticate("google", {
      scope: ["profile", "email"]
    })
  );
  
  router.get("/google/redirect", passport.authenticate('google'), (req, res) =&gt; {
    res.redirect('/');
  });
  </code></pre>
  
  <p>I can't seem to understand how am I supposed to check after the auth process that the user is logged in with react.
  Also, I do not use a DB store as I don't need one I just need to make sure a user as logged in. (is that something that can be done or storing the user is a must?)
  What am I missing?</p>