Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
sahat committed Mar 7, 2015
2 parents 61b30a4 + efefe8a commit bd0e161
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions satellizer.js
Original file line number Diff line number Diff line change
Expand Up @@ -525,14 +525,15 @@
var defaults = {
url: null,
name: null,
popupOptions: null
popupOptions: null,
redirectUri: null
};

var oauth1 = {};

oauth1.open = function(options, userData) {
angular.extend(defaults, options);
return popup.open(defaults.url, defaults.popupOptions)
return popup.open(defaults.url, defaults.popupOptions, defaults.redirectUri)
.then(function(response) {
return oauth1.exchangeForToken(response, userData);
});
Expand Down Expand Up @@ -597,6 +598,7 @@
var parser = document.createElement('a');
parser.href = event.url;

if(parser.search || parser.hash){
var queryParams = parser.search.substring(1).replace(/\/$/, '');
var hashParams = parser.hash.substring(1).replace(/\/$/, '');
var hash = utils.parseQueryString(hashParams);
Expand All @@ -607,10 +609,17 @@
if (qs.error) {
deferred.reject({ error: qs.error });
} else {
deferred.resolve({ code: qs.code });
deferred.resolve(qs);
}

popupWindow.close();
}
});
popupWindow.addEventListener('exit', function() {
deferred.reject({data: 'Provider Popup was closed'});
});
popupWindow.addEventListener('loaderror', function() {
deferred.reject({data: 'Authorization Failed'});
});

return deferred.promise;
Expand Down

0 comments on commit bd0e161

Please sign in to comment.