Skip to content
Browse files

Also check intermediate error for fetchAuthorizationInformation()

We were also skipping over the intermediate error from the provider's
fetchAuthorizationInformation(), which will cause an (incorrect) error
about the provider interface.
  • Loading branch information...
1 parent 5a73712 commit 0c2f74961164f82b0dc2dc5bf259910bb8fe8b0d @evanp committed May 28, 2012
Showing with 7 additions and 3 deletions.
  1. +7 −3 lib/auth.strategies/oauth/_oauthservices.js
View
10 lib/auth.strategies/oauth/_oauthservices.js
@@ -298,9 +298,13 @@ exports.OAuthServices.prototype.authorize= function(request, protocol, callback)
**/
exports.OAuthServices.prototype.fetchAuthorizationInformation = function(username, token, callback) {
this.provider.fetchAuthorizationInformation(username, token, function(err, application, user) {
- if(application.title == null || application.description == null || user.token == null || user.username == null) { callback(new errors.OAuthProviderError("provider: applicationByConsumerKey must return a application object with fields [title, description] and a user object with fields [username, token]"), null); return;}
- // Return the value to calling plugin
- callback(err, application, user);
+ if(err) {
+ callback(new errors.OAuthProviderError('Invalid Username/Token'), null, null);
+ } else if(application.title == null || application.description == null || user.token == null || user.username == null) { callback(new errors.OAuthProviderError("provider: fetchAuthorizationInformation must return a application object with fields [title, description] and a user object with fields [username, token]"), null, null); return;
+ } else {
+ // Return the value to calling plugin
+ callback(err, application, user);
+ }
});
}

0 comments on commit 0c2f749

Please sign in to comment.
Something went wrong with that request. Please try again.