Permalink
Browse files

Fix dynamic scoping caching issue

  • Loading branch information...
1 parent 6d335c5 commit 445819b4f9ecbfa9a560a100fbd968efb2764c29 @kyriesent kyriesent committed Jan 29, 2013
Showing with 11 additions and 10 deletions.
  1. +11 −10 lib/modules/oauth2.js
View
@@ -108,16 +108,17 @@ everyModule.submodule('oauth2')
// function () {
// return this._scope && this.scope();
// }
- additionalParams[k] = // cache the function call
- param = param.call(this);
- }
- if ('function' === typeof param) {
- // this.scope() itself could be a function
- // to allow for dynamic scope determination - e.g.,
- // function (req, res) {
- // return req.session.onboardingPhase; // => "email"
- // }
- param = param.call(this, req, res);
+ param = param.call(this);
+ if ('function' === typeof param) {
+ // this.scope() itself could be a function
+ // to allow for dynamic scope determination - e.g.,
+ // function (req, res) {
+ // return req.session.onboardingPhase; // => "email"
+ // }
+ param = param.call(this, req, res);
+ } else {
+ additionalParams[k] = param // cache the function call if not dynamically generated
+ }
}
params[k] = param;
}

0 comments on commit 445819b

Please sign in to comment.