code: function facebookReq(req, res){
      var redirectUrl = _.has(grasshopper.config.identities, 'facebook') ? grasshopper.config.identities.facebook.redirectUrl : 'defaultRoute';
  
      BB.bind({token: req.session.token, params: req.query, res: res, req: req, user: null })
          .then(function(){
              if(!_.isUndefined(this.token)){
                  this.token = new Buffer(this.token, 'base64'); //A token exists, let's decode it
  
                  return _linkSocialAccount.call(this);
              }
              else {
                  return _createSocialAccount.call(this);
              }
          })
          .then(function(){
              res.redirect(redirectUrl);
          })
          .catch(function(err){
              console.log(err.stack);
              res.redirect(redirectUrl + '?error='+ err.message);
          });
  }
docs: Middleware that handles all of the logic for creating and linking social accounts.