github-oauth.js
function authenticate(req, cb) {
    request.post(
      'https://github.com/login/oauth/access_token',
      { form:
        { client_id: process.env.GHID,      // don't store credentials in opts
          client_secret: process.env.GHCS,  // get them straight from process.env
          code: req.query.code } },
      function(err, resp, body) {
        if (err) return cb(err);
        var result = qs.parse(body);
        getUser(req, result, function() {
          cb(null, result);
        });
      }
    );
  }
function authenticate(req, cb) {
    request.post(
      'https://github.com/login/oauth/access_token',
      { form:
        { client_id: process.env.GHID,      // don't store credentials in opts
          client_secret: process.env.GHCS,  // get them straight from process.env
          code: req.query.code } },
      function(err, resp, body) {
        if (err) return cb(err);
        var result = qs.parse(body);
        getUser(req, result, function() {
          cb(null, result);
        });
      }
    );
  }
function authenticate ( req , cb ) { request . post ( 'https://github.com/login/oauth/access_token' , { form : { client_id : process . env . GHID , // don't store credentials in opts client_secret : process . env . GHCS , // get them straight from process.env code : req . query . code } } , function ( err , resp , body ) { if ( err ) return cb ( err ) ; var result = qs . parse ( body ) ; getUser ( req , result , function ( ) { cb ( null , result ) ; } ) ; } ) ; }
get access token from github
get access token from github