summaryrefslogtreecommitdiffstats
path: root/packages/wekan-accounts-oidc/oidc.js
blob: 75cd89aeb79d91b292787e6301d7bf9e0ec4eea9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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;
    }

    var credentialRequestCompleteCallback = Accounts.oauth.credentialRequestCompleteHandler(callback);
    Oidc.requestCredential(options, credentialRequestCompleteCallback);
  };
} else {
  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']
  });
}