Skip to content

Commit

Permalink
Use withCredentials from config to login/unlink/signup
Browse files Browse the repository at this point in the history
  • Loading branch information
sahat committed Dec 20, 2015
1 parent b850ee7 commit 167c021
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 9 deletions.
2 changes: 1 addition & 1 deletion examples/client/controllers/login.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ angular.module('MyApp')
}
});
};
});
});
2 changes: 1 addition & 1 deletion examples/server/node/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ module.exports = {
// OAuth 1.0
TWITTER_KEY: process.env.TWITTER_KEY || 'YOUR_TWITTER_CONSUMER_KEY',
TWITTER_SECRET: process.env.TWITTER_SECRET || 'YOUR_TWITTER_CONSUMER_SECRET'
};
};
13 changes: 8 additions & 5 deletions satellizer.js
Original file line number Diff line number Diff line change
Expand Up @@ -435,12 +435,13 @@ if (typeof module !== 'undefined' && typeof exports !== 'undefined' && module.ex
};

Oauth.unlink = function(provider, opts) {
opts = opts || {};
opts.url = opts.url ? opts.url : utils.joinUrl(config.baseUrl, config.unlinkUrl);
opts.data = { provider: provider } || opts.data;
opts.method = opts.method || 'POST';
opts = opts || {};
opts.url = opts.url ? opts.url : utils.joinUrl(config.baseUrl, config.unlinkUrl);
opts.data = { provider: provider } || opts.data;
opts.method = opts.method || 'POST';
opts.withCredentials = opts.withCredentials || config.withCredentials;

return $http(opts);
return $http(opts);
};

return Oauth;
Expand All @@ -458,6 +459,7 @@ if (typeof module !== 'undefined' && typeof exports !== 'undefined' && module.ex
opts.url = opts.url ? opts.url : utils.joinUrl(config.baseUrl, config.loginUrl);
opts.data = user || opts.data;
opts.method = opts.method || 'POST';
opts.withCredentials = opts.withCredentials || config.withCredentials;

return $http(opts).then(function(response) {
shared.setToken(response);
Expand All @@ -470,6 +472,7 @@ if (typeof module !== 'undefined' && typeof exports !== 'undefined' && module.ex
opts.url = opts.url ? opts.url : utils.joinUrl(config.baseUrl, config.signupUrl);
opts.data = user || opts.data;
opts.method = opts.method || 'POST';
opts.withCredentials = opts.withCredentials || config.withCredentials;

return $http(opts);
};
Expand Down
Loading

0 comments on commit 167c021

Please sign in to comment.