1.0.2 • Published 6 months ago

passport-sendoso-postilize v1.0.2

Weekly downloads
-
License
-
Repository
-
Last release
6 months ago

Passport-Sendoso-postilize

Passport strategies for authenticating with Sendoso using OAuth 2.0.

This module lets you authenticate using Sendoso credentials in your Node.js applications. By plugging into Passport, Sendoso authentication can be easily and unobtrusively integrated into any application or framework that supports Connect-style middleware, including Express.

Install

$ npm install Passport-Sendoso-postilize

Usage of OAuth 2.0

Configure Strategy

The Sendoso OAuth 2.0 authentication strategy authenticates users using a Sendoso 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.

var SendosoStrategy = require( 'Passport-Sendoso-postilize' ).Strategy;

passport.use(new SendosoStrategy({
    clientID:     SENDOSO_CLIENT_ID,
    clientSecret: SENDOSO_CLIENT_SECRET,
    callbackURL: "http://yourdomain:3000/auth/sendoso/callback",
    passReqToCallback   : true
  },
  function(request, accessToken, refreshToken, profile, done) {
    // Information is sent back here.
  }
));

Authenticate Requests

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

For example, as route middleware in an Express application:

app.get('/auth/sendoso',
  passport.authenticate('google', { scope: 'contacts content' }
));

app.get( '/auth/sendoso/callback',
	passport.authenticate( 'sendoso', {
		successRedirect: '/auth/sendoso/success',
		failureRedirect: '/auth/sendoso/failure'
}));

License

The MIT License