Skip to content

Commit

Permalink
bypass exchangeForToken and setToken when no url = null
Browse files Browse the repository at this point in the history
  • Loading branch information
sahat committed Nov 6, 2015
1 parent f309c2d commit bacd50e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
13 changes: 11 additions & 2 deletions satellizer.js
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,12 @@ if (typeof module !== 'undefined' && typeof exports !== 'undefined' && module.ex

provider.open(config.providers[name], userData || {})
.then(function(response) {
shared.setToken(response, false);
// This is for a scenario when someone wishes to opt out from
// Satellizer's magic by doing authorization code exchange and
// saving a token manually.
if (config.providers[name].url) {
shared.setToken(response, false);
}
deferred.resolve(response);
})
.catch(function(error) {
Expand Down Expand Up @@ -511,7 +516,11 @@ if (typeof module !== 'undefined' && typeof exports !== 'undefined' && module.ex

return openPopup
.then(function(oauthData) {
if (defaults.responseType === 'token') {
// When no server URL provided, return popup params as-is.
// This is for a scenario when someone wishes to opt out from
// Satellizer's magic by doing authorization code exchange and
// saving a token manually.
if (defaults.responseType === 'token' || !defaults.url) {
return oauthData;
}

Expand Down
Loading

0 comments on commit bacd50e

Please sign in to comment.