-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathbox.js
29 lines (25 loc) · 1015 Bytes
/
box.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
27
28
29
Accounts.oauth.registerService('box');
if (Meteor.isClient) {
Meteor.loginWithBox = function(options, callback) {
// support a callback without options
if (!callback && typeof options === "function") {
callback = options;
options = {};
}
if (!options)
options = {};
var credentialRequestCompleteCallback = Accounts.oauth.credentialRequestCompleteHandler(callback);
Box.requestCredential(options, credentialRequestCompleteCallback);
};
} else {
Accounts.addAutopublishFields({
forLoggedInUser: _.map(
Box.whitelistedFields,
function (subfield) { return 'services.box.' + subfield; }),
forOtherUsers: _.map(
// even with autopublish, no legitimate web app should be
// publishing all users' emails
_.without(Box.whitelistedFields, 'email', 'verified_email'),
function (subfield) { return 'services.box.' + subfield; })
});
}