title: How to set the current host for Passport strategy callbackURL?
body: <p>I'm using the Passport-Linkedin strategy for Passport with Express, to allow users to log in with their LinkedIn profile.</p>
  
  <p>I have the following code:</p>
  
  <pre><code>passport.use(new LinkedInStrategy({
      consumerKey: config.linkedin.LINKEDIN_API_KEY,
      consumerSecret: config.linkedin.LINKEDIN_SECRET_KEY,
      callbackURL: "http://localhost:3000/auth/linkedin/callback"
    },
    function(token, tokenSecret, profile, done) {
      // asynchronous verification, for effect...
      process.nextTick(function () {
  
        // To keep the example simple, the user's LinkedIn profile is returned to
        // represent the logged-in user.  In a typical application, you would want
        // to associate the LinkedIn account with a user record in your database,
        // and return that user instead.
        return done(null, profile);
      });
    }
  ));
  </code></pre>
  
  <p>On line 4, I have to set the full callback URL manually. I had one string for production and one for development, but my URLs keep changing, and so do the ports (I use 2 machines to develop).</p>
  
  <p>How can I set the first portion of the URL (<code>http://localhost:3000</code>) automatically? Is there a property of <code>express</code> or <code>app</code> that would allow me to do that? Do I need to resort to an <code>app.use(function(req, res){});</code>?</p>
  
  <p>Thanks!</p>