oidc.js 927 B

12345678910111213141516171819202122232425
  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. console.log(options.loginStyle);
  10. console.log(callback);
  11. var credentialRequestCompleteCallback = Accounts.oauth.credentialRequestCompleteHandler(callback);
  12. console.log("credentialCallback",credentialRequestCompleteCallback);
  13. Oidc.requestCredential(options, credentialRequestCompleteCallback);
  14. };
  15. }
  16. else {
  17. Accounts.addAutopublishFields({
  18. // not sure whether the OIDC api can be used from the browser,
  19. // thus not sure if we should be sending access tokens; but we do it
  20. // for all other oauth2 providers, and it may come in handy.
  21. forLoggedInUser: ['services.oidc'],
  22. forOtherUsers: ['services.oidc.id']
  23. });
  24. }