2019-04-20 15:18:33 +03:00
|
|
|
Accounts.oauth.registerService('oidc');
|
|
|
|
|
|
|
|
if (Meteor.isClient) {
|
|
|
|
Meteor.loginWithOidc = function(options, callback) {
|
|
|
|
// support a callback without options
|
|
|
|
if (! callback && typeof options === "function") {
|
|
|
|
callback = options;
|
|
|
|
options = null;
|
|
|
|
}
|
2022-08-30 23:12:23 +03:00
|
|
|
|
2019-04-20 15:18:33 +03:00
|
|
|
var credentialRequestCompleteCallback = Accounts.oauth.credentialRequestCompleteHandler(callback);
|
|
|
|
Oidc.requestCredential(options, credentialRequestCompleteCallback);
|
|
|
|
};
|
2022-08-30 23:12:23 +03:00
|
|
|
} else {
|
2019-04-20 15:18:33 +03:00
|
|
|
Accounts.addAutopublishFields({
|
|
|
|
// not sure whether the OIDC 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.oidc'],
|
|
|
|
forOtherUsers: ['services.oidc.id']
|
|
|
|
});
|
|
|
|
}
|