Skip to content

A Passport strategy for authenticating using a Discourse forum

License

Notifications You must be signed in to change notification settings

nomadgate/passport-discourse

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

passport-discourse

A Passport strategy for authenticating using a Discourse forum

Usage

This implements the Discourse SSO functionality if you want to make another site use Discourse's authentication. I'm no expert at Passport - so please send pull requests.

See more on this protocol in this thread.

...
var passportDiscourse = require("../../passport-discourse").Strategy,

...

router.get("/auth/discourse_sso", passport.authenticate("discourse"));
router.get(passportDiscourse.route_callback, passport.authenticate("discourse", {
  successRedirect: proxyPath + "/auth/done",
  failureRedirect: proxyPath + "/login"
}));

if (auth.discourse_sso.enabled) {
  var auth_discourse = new passportDiscourse({
    secret: auth.discourse_sso.discourse_secret,
    discourse_url: auth.discourse_sso.discourse_url,
    debug: auth.discourse_sso.debug
  },function(accessToken, refreshToken, profile, done){
      usedAuthentication("discourse");
      done(null, profile);
  });
  passport.use(auth_discourse);
}

About

A Passport strategy for authenticating using a Discourse forum

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%