-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathimis.js
26 lines (24 loc) · 947 Bytes
/
imis.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
Accounts.oauth.registerService('imis');
if (Meteor.isClient) {
const loginWithImis = (options, callback) => {
// support a callback without options
if (!callback && typeof options === 'function') {
callback = options;
options = null;
}
const credentialRequestCompleteCallback = Accounts.oauth.credentialRequestCompleteHandler(
callback
);
Imis.requestCredential(options, credentialRequestCompleteCallback);
};
Accounts.registerClientLoginFunction('imis', loginWithImis);
Meteor.loginWithImis = (...args) => Accounts.applyLoginFunction('imis', args);
} 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.imis'],
forOtherUsers: ['services.imis.username'],
});
}