code: function (req, res, next) {
      var accessTokenUrl = 'https://api.login.yahoo.com/oauth2/get_token';
      var clientId = req.body.clientId;
      var clientSecret = config.YAHOO_SECRET;
      var clientSecret64 = new Buffer(clientId + ':' + clientSecret).toString('base64');
      var headers = { Authorization: 'Basic ' + clientSecret64 };
      var formData = {
        code: req.body.code,
        redirect_uri: req.body.redirectUri,
        grant_type: 'authorization_code'
      };
  
      request.post({ url: accessTokenUrl, form: formData, headers: headers, json: true }, function(err, response, body) {
        if (err) {
          res.status(500).send(err);
          return;
        }
        req.accessToken = body.access_token;
        req.xoauth_yahoo_guid = body.xoauth_yahoo_guid;
        next();
      });
    }
docs: Step 1. Exchange authorization code for access token.