code: function login(req, res, test) {
    var protocol = "https://";
    if(test === true || req.test) protocol = "http://";  //for testing
  
    var loginServer = req.query.login_server || "login.salesforce.com";
    var url = protocol + loginServer + "/services/oauth2/authorize";
    
    var state = JSON.stringify({
      loginServer: loginServer,
      appUrl: req.query.app_url || process.env.SALESFORCE_FINAL_URL || "/login/whoami",
      profile: req.query.profile
    });
  
    var options = {
      response_type: "code",
      client_id: process.env.SALESFORCE_CLIENT_ID,
      redirect_uri: process.env.SALESFORCE_REDIRECT_URL,
      state: state
    }
    
    return res.redirect(url + "?" + querystring.stringify(options) );
  }
docs: Starts the Salesforce Server Dance Auth Leg 1