Skip to content

Chris927/chris2-accounts-mitre

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Use Your Own OAuth2 Provider

Use your own OAuth2 server (tested with the awesome MitreID Connect server) as authentication provider in your Meteor app.

How

Add this package:

meteor add chris2:accounts-mitre

Then configure the mitre service with client id and secret etc., as provided by your (own) oauth2 provider:

if (Meteor.isServer) {
  Meteor.startup(function () {
    ServiceConfiguration.configurations.remove({
      service: 'mitre'
    });
    ServiceConfiguration.configurations.insert({
      service: 'mitre',
      clientId: 'fill in',
      loginStyle: 'redirect',
      secret: 'fill in',
      issuer: 'https://myauthserver.com',
      requestPermissions: [ 'email', 'userinfo', 'openid' ]
    });
  });
}

Assuming you want to login by clicking a button, the following should work:

Template.someTemplate.events({
  'click .login': function () {
    Meteor.loginWithMitre({}, function(err) {
      if (err) {
        console.log('loginWithMitre, err=', err);
      }
    });
  },
  'click .logout': function() {
    Meteor.logout();
  }
});

Example

Grab this demo Meteor app for a functioning example. (You have to run it yourself against your own oauth2 provider...)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published