oidc.js 790 B

12345678910111213141516171819202122
  1. Accounts.oauth.registerService('oidc');
  2. if (Meteor.isClient) {
  3. Meteor.loginWithOidc = function(options, callback) {
  4. // support a callback without options
  5. if (! callback && typeof options === "function") {
  6. callback = options;
  7. options = null;
  8. }
  9. var credentialRequestCompleteCallback = Accounts.oauth.credentialRequestCompleteHandler(callback);
  10. Oidc.requestCredential(options, credentialRequestCompleteCallback);
  11. };
  12. }
  13. else {
  14. Accounts.addAutopublishFields({
  15. // not sure whether the OIDC api can be used from the browser,
  16. // thus not sure if we should be sending access tokens; but we do it
  17. // for all other oauth2 providers, and it may come in handy.
  18. forLoggedInUser: ['services.oidc'],
  19. forOtherUsers: ['services.oidc.id']
  20. });
  21. }