Permalink
Browse files

authorizeUrlMethod() checks err returned from fetchAuthorizationInfor…

…mation()

We weren't checking the err response before. This patch adds a quick check and a call to the authorize_provider if there's an error.
  • Loading branch information...
1 parent e1c75d2 commit 5a7371206d8d5df7a59adab88b59000ae75574a3 @evanp committed May 28, 2012
Showing with 7 additions and 2 deletions.
  1. +7 −2 lib/auth.strategies/oauth/oauth.js
@@ -128,8 +128,13 @@ module.exports= function(options) {
} else {
// Fetch the needed data
my['oauth_service'].fetchAuthorizationInformation(req.body['username'], result.token, function(err, application, user) {
- // Signal callback about finish authorization
- my.authorize_provider.call(self, null, req, res, true, result, application, user);
+ if(err) {
+ // Delegate to the function of the user
+ my.authorize_provider.call(self, err, req, res, false, {token:req.body['oauth_token']});
+ } else {
+ // Signal callback about finish authorization
+ my.authorize_provider.call(self, null, req, res, true, result, application, user);
+ }
});
}
});

0 comments on commit 5a73712

Please sign in to comment.