Skip to content

Commit

Permalink
Reject the correct deferred on error.
Browse files Browse the repository at this point in the history
The deferred was not being rejected when popup was being rejected. The 'return' statement looks misleading, as it is encapsulated inside a timeout, and thus nothing is actually being returned.
  • Loading branch information
fromkeith committed Mar 30, 2016
1 parent ae7912b commit 9fe606a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion satellizer.js
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,7 @@ if (typeof module !== 'undefined' && typeof exports !== 'undefined' && module.ex
openPopup = popup.open(url, defaults.name, defaults.popupOptions, defaults.redirectUri).pollPopup(defaults.redirectUri);
}

return openPopup
openPopup
.then(function(oauthData) {
// When no server URL provided, return popup params as-is.
// This is for a scenario when someone wishes to opt out from
Expand All @@ -540,6 +540,8 @@ if (typeof module !== 'undefined' && typeof exports !== 'undefined' && module.ex
}

defer.resolve(Oauth2.exchangeForToken(oauthData, userData));
}, function (err) {
defer.reject(err);
});
});

Expand Down

0 comments on commit 9fe606a

Please sign in to comment.