passport-slidefuse

0.0.4 • Public • Published

Passport-Slidefuse

Passport strategy for authenticating with Slidefuse using the OAuth 2.0 API.

Install

$ npm install passport-slidefuse

Usage

Configure Strategy

The Slidefuse authentication strategy authenticates users using a Slidefuse account and OAuth 2.0 tokens. The strategy requires a verify callback, which accepts these credentials and calls done providing a user, as well as options specifying a client ID, client secret, and callback URL.

passport.use(new SlidefuseStrategy({
    clientID: SF_CLIENT_ID,
    clientSecret: SF_CLIENT_SECRET,
    callbackURL: "http://localhost:3000/login/callback"
  },
  function(accessToken, refreshToken, profile, done) {
    User.findOrCreate({ sfId: profile.id }, function (err, user) {
      return done(err, user);
    });
  }
));

Authenticate Requests

Use passport.authenticate(), specifying the 'slidefuse' strategy, to authenticate requests.

For example, as route middleware in an Express application:

app.get('/login',
  passport.authenticate('slidefuse'));

app.get('/login/callback', 
  passport.authenticate('slidefuse', { failureRedirect: '/login' }),
  function(req, res) {
    // Successful authentication, redirect home.
    res.redirect('/');
  });

Credits

Readme

Keywords

none

Package Sidebar

Install

npm i passport-slidefuse

Weekly Downloads

7

Version

0.0.4

License

none

Last publish

Collaborators

  • spencersharkey