|  Lauri Ojansivu
				
				1e4fba3ec8
				Added back autologin, because reverting it broke Google OIDC login. | 3 年之前 | |
|---|---|---|
| .. | ||
| .gitignore | 3 年之前 | |
| LICENSE.txt | 3 年之前 | |
| README.md | 3 年之前 | |
| oidc.js | 3 年之前 | |
| oidc_login_button.css | 3 年之前 | |
| package.js | 3 年之前 | |
A Meteor login service for OpenID Connect (OIDC).
meteor add salleman:accounts-oidc
Meteor.loginWithOidc(options, callback)
options - object containing options, see below (optional)callback - callback function (optional)Template.myTemplateName.events({
  'click #login-button': function() {
    Meteor.loginWithOidc();
  }
);
These options override service configuration stored in the database.
loginStyle: redirect or popupredirectUrl: Where to redirect after successful login. Only used if loginStyle is set to redirectYou can manually configure this package by upserting the service configuration on startup. First, add the service-configuration package:
meteor add service-configuration
The following service configuration are available:
clientId: OIDC client identifiersecret: OIDC client shared secretserverUrl: URL of the OIDC server. e.g. https://openid.example.org:8443authorizationEndpoint: Endpoint of the OIDC authorization service, e.g. /oidc/authorizetokenEndpoint: Endpoint of the OIDC token service, e.g. /oidc/tokenuserinfoEndpoint: Endpoint of the OIDC userinfo service, e.g. /oidc/userinfoidTokenWhitelistFields: A list of fields from IDToken to be added to Meteor.user().services.oidc objectThen in your project:
if (Meteor.isServer) {
  Meteor.startup(function () {
    ServiceConfiguration.configurations.upsert(
      { service: 'oidc' },
      {
        $set: {
          loginStyle: 'redirect',
          clientId: 'my-client-id-registered-with-the-oidc-server',
          secret: 'my-client-shared-secret',
          serverUrl: 'https://openid.example.org',
          authorizationEndpoint: '/oidc/authorize',
          tokenEndpoint: '/oidc/token',
          userinfoEndpoint: '/oidc/userinfo',
          idTokenWhitelistFields: []
        }
      }
    );
  });
}