summaryrefslogtreecommitdiffstats
path: root/packages/wekan-accounts-oidc/oidc.js
diff options
context:
space:
mode:
Diffstat (limited to 'packages/wekan-accounts-oidc/oidc.js')
-rw-r--r--packages/wekan-accounts-oidc/oidc.js22
1 files changed, 22 insertions, 0 deletions
diff --git a/packages/wekan-accounts-oidc/oidc.js b/packages/wekan-accounts-oidc/oidc.js
new file mode 100644
index 00000000..75cd89ae
--- /dev/null
+++ b/packages/wekan-accounts-oidc/oidc.js
@@ -0,0 +1,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']
+ });
+}