title: How can I access profile information in google Oauth2 passport?
body: <p>So I want the index page to show the name of the user currently logged in in the footer of the index page.<br />
  <strong>My google login routes</strong></p>
  <pre><code>router.get(&quot;/login/google&quot;, passport.authenticate('google', { scope:
      [ 'email', 'profile' ] }));
  router.get(&quot;/login/google/callback&quot;, passport.authenticate(&quot;google&quot;, {
      successRedirect: &quot;/videos&quot;,
      failureRedirect: &quot;/login/google/error&quot;
  }));
  router.get(&quot;/login/google/error&quot;, (req, res) =&gt; {
      res.send(&quot;Error in google login&quot;)
  })
  </code></pre>
  <p><strong>My google Strategy</strong></p>
  <pre><code>passport.use(new GoogleStrategy({
      clientID: GOOGLE_CLIENT_ID,
      clientSecret: GOOGLE_CLIENT_SECRET,
      callbackURL: &quot;http://localhost:3000/login/google/callback&quot;,
      passReqToCallback: true
    },
    function(request, accessToken, refreshToken, profile, done) {
      User.findOrCreate({ googleId: profile.id }, function (err, user) {
        return done(err, user);
      });
    }
  ));
  </code></pre>
  <p><strong>My footer of the index file</strong></p>
  <pre><code>    &lt;footer&gt;
      &lt;% if(!auth){ %&gt;
        &lt;li class=&quot;nav-item&quot;&gt;
          &lt;a href=&quot;/register&quot; class=&quot;nav-link active&quot;&gt;Register!&lt;/a&gt;
          &lt;li class=&quot;nav-item&quot;&gt;
            &lt;a href=&quot;/login&quot; class=&quot;nav-link active&quot;&gt;Log In&lt;/a&gt;
          &lt;/li&gt;
        &lt;/li&gt;
      &lt;% } else { %&gt;
        &lt;li class=&quot;nav-item&quot;&gt;
          &lt;a href=&quot;#&quot; class=&quot;nav-link disabled&quot;&gt;Welcome, &lt;%= auth.username %&gt; &lt;/a&gt;
        &lt;/li&gt;
        &lt;li class=&quot;nav-item&quot;&gt;
          &lt;a href=&quot;/logout&quot; class=&quot;nav-link active&quot;&gt;Log Out&lt;/a&gt;
        &lt;/li&gt;
      &lt;% } %&gt;
    &lt;div class=&quot;d-flex justify-content-center mt-3&quot;&gt;
    &lt;ul class=&quot;nav&quot;&gt;
      &lt;li class=&quot;nav-item&quot;&gt;
        &lt;div class=&quot;g-ytsubscribe&quot; data-channelid=&quot;UCAjHeCmPJ5lDVWw6dL_jQng&quot; data-layout=&quot;default&quot; data-count=&quot;default&quot;&gt;&lt;/div&gt;
      &lt;/li&gt;
    &lt;/ul&gt;
  &lt;/footer&gt;
  </code></pre>
  <p><strong>My Footer</strong><br />
  <img src="https://i.ibb.co/MZ0R1PL/Capture3.png" alt="Footer IMG" /></p>