mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
27 lines
978 B
JavaScript
27 lines
978 B
JavaScript
Accounts.oauth.registerService('github');
|
|
|
|
if (Meteor.isClient) {
|
|
const loginWithGithub = function(options, callback) {
|
|
// support a callback without options
|
|
if (! callback && typeof options === "function") {
|
|
callback = options;
|
|
options = null;
|
|
}
|
|
|
|
var credentialRequestCompleteCallback = Accounts.oauth.credentialRequestCompleteHandler(callback);
|
|
Github.requestCredential(options, credentialRequestCompleteCallback);
|
|
};
|
|
Accounts.registerClientLoginFunction('github', loginWithGithub);
|
|
Meteor.loginWithGithub = function () {
|
|
return Accounts.applyLoginFunction('github', arguments);
|
|
};
|
|
} else {
|
|
Accounts.addAutopublishFields({
|
|
// not sure whether the github api can be used from the browser,
|
|
// thus not sure if we should be sending access tokens; but we do it
|
|
// for all other oauth2 providers, and it may come in handy.
|
|
forLoggedInUser: ['services.github'],
|
|
forOtherUsers: ['services.github.username']
|
|
});
|
|
}
|