Use your own OAuth2 server (tested with the awesome MitreID Connect server) as authentication provider in your Meteor app.
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();
}
});
Grab this demo Meteor app for a functioning example. (You have to run it yourself against your own oauth2 provider...)