Skip to content

Commit

Permalink
Removes callback with param 'params' and adds option 'passReqToCallba…
Browse files Browse the repository at this point in the history
…ck' to pass req into callback function.
  • Loading branch information
rodrigok committed Mar 18, 2013
1 parent 2126269 commit ff70b9e
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions lib/passport-facebook-token/strategy.js
Expand Up @@ -43,6 +43,8 @@ function FacebookTokenStrategy(options, verify) {
options.authorizationURL = options.authorizationURL || 'https://www.facebook.com/dialog/oauth';
options.tokenURL = options.tokenURL || 'https://graph.facebook.com/oauth/access_token';
options.scopeSeparator = options.scopeSeparator || ',';

this._passReqToCallback = options.passReqToCallback;

OAuth2Strategy.call(this, options, verify);
this.name = 'facebook-token';
Expand Down Expand Up @@ -86,10 +88,9 @@ FacebookTokenStrategy.prototype.authenticate = function(req, options) {
self.success(user, info);
}

var arity = self._verify.length;
if (arity == 5) {
self._verify(accessToken, refreshToken, params, profile, verified);
} else { // arity == 4
if (self._passReqToCallback) {
self._verify(req, accessToken, refreshToken, profile, verified);
} else {
self._verify(accessToken, refreshToken, profile, verified);
}
});
Expand Down

0 comments on commit ff70b9e

Please sign in to comment.