title: How can I access OAuth's state parameter using Passport.js?
body: <p>I'm using Passport.js to do authentication, and per <a href="https://developers.google.com/accounts/docs/OAuth2Login#formingtheurl" rel="noreferrer">Google's OAuth2 documentation</a>, I'm passing in a state variable:</p>
  
  <pre><code>app.get('/authenticate/googleOAuth', function(request, response) {
    passport.authenticate('google', {
      scope:
      [
        'https://www.googleapis.com/auth/userinfo.profile',
        'https://www.googleapis.com/auth/userinfo.email'
      ],
      state: { blah: 'test' }
    })(request, response);
  });
  </code></pre>
  
  <p>However, I can't seem to access that variable at a later date:</p>
  
  <pre><code>passport.use(new googleStrategy(
  {
      clientID: '...',
      clientSecret: '...',
      callbackURL: '...',
      passReqToCallback: true
  },
  function(request, accessToken, refreshToken, profile, done) {
    console.log('state: ' + request.query.state);
    login(profile, done);
  }));
  </code></pre>
  
  <p>request.query.state is undefined. request.param("state") doesn't work, either.</p>
  
  <p>How can I get at that variable after the authentication callback?</p>