lib/oauth.js
function initTokenSession(req, res, next) {
    var provider = getProviderToken(req.path);
    return user.createSession(req.user._id, provider, req)
      .then(function(mySession) {
        return BPromise.resolve(mySession);
      })
      .then(function (session) {
        res.status(200).json(session);
      }, function (err) {
        return next(err);
      });
  }
function initTokenSession(req, res, next) {
    var provider = getProviderToken(req.path);
    return user.createSession(req.user._id, provider, req)
      .then(function(mySession) {
        return BPromise.resolve(mySession);
      })
      .then(function (session) {
        res.status(200).json(session);
      }, function (err) {
        return next(err);
      });
  }
Function to initialize a session following authentication from a socialAuth provider