title: Google Auth changing logged in status in Passport
body: <p>The 'req.isAuthenticated()' coming from Google shows true, then in another route shows false.</p>
  <p>Here is the Google Auth file, showing the call to Google and the callback.</p>
  <pre><code>const express = require('express'),
  passport = require('passport'),
  router= express.Router();
  
  
  
  // @desc Auth with Google
  // @route GET /google
  router.get('/', passport.authenticate('google', {
      scope: ['profile']}));
  
  // @desc Google auth callback
  // @route GET /google/callback
  router.get('/callback', passport.authenticate('google', {
      failureRedirect: '/login'}),( req,res ) =&gt; {
      console.log( &quot; `Is the user authenticated? `&quot; + req.isAuthenticated() 
  );
      res.redirect('/dashboard');
  })
  
  
  // @desc Logout the user
  // @route /google/logout
  router.get('/logout', (req,res) =&gt; {
      req.logout();
      res.redirect('/');
  })
  
  
  module.exports = router;
  </code></pre>
  <p>The console.log in the middle works and shows <code>Is the user authenticated? true</code></p>
  <p>Here is my middleware for auth</p>
  <pre><code>module.exports = {
      ensureAuth: function ( req, res, next ) {
          console.log(&quot;entering ensure Auth!&quot;)
          if (req.isAuthoized) {
              console.log(&quot;Middleware, is authenticated with ensure Auth&quot;)
              return next();
          } else {
              console.log(req.isAuthenticated())
              console.log(&quot;middleware, is not authenticated&quot;)
              res.redirect('/');
          }
      },
      ensureGuest: function ( req, res, next ) {
          if (req.isAuthorized) {
              console.log(req.isAuthenticated())
              console.log(&quot;Middleware, is authenticated with ensureGuest&quot;)
              res.redirect('/dashboard')
          } else {
              console.log(req.isAuthenticated())
              console.log(&quot;Middleware, is not authenticated with ensureGuest&quot;)
              return next();
          }
      }
  }
  </code></pre>
  <p>All of the above console.logs show false.</p>
  <p>Here is a screenshot of the log.</p>
  <p><a href="https://i.stack.imgur.com/9HQ7r.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/9HQ7r.png" alt="enter image description here" /></a></p>
  <p>What is going on here? The method is just passed down the line and it changes?</p>