0.2.3 • Published 8 years ago

passport-pixelpin v0.2.3

Weekly downloads
8
License
MIT
Repository
-
Last release
8 years ago

Passport-PixelPin

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

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

Create your PixelPin developer account here. New to Node.js and passportjs? Click here.

Install

$ npm install passport-pixelpin

Usage

Configure Strategy

The PixelPin authentication strategy authenticates users using a PixelPin developer 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 app ID, app secret, responseType and callback URL.

passport.use(new PixelPinStrategy({
clientID: PIXELPIN_APP_ID,
clientSecret: PIXELPIN_APP_SECRET,
responseType: "code",
callbackURL: "http://node.local.com:8080/auth/pixelpin/callback"
},
function(accessToken, refreshToken, profile, done) {
process.nextTick(function () {
	return done(null,profile);
	});
}));

Authenticate Requests

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

For example, as route middleware in an Express application:

app.get('/auth/pixelpin',
passport.authenticate('pixelpin', {scope: ['email']}),
function(req,res){

});

app.get('/auth/pixelpin/callback',
passport.authenticate('pixelpin', { failureRedirect: '/login'}),
function(req,res) {
res.redirect('/');
});

Examples

For a complete, working example, refer to the login example.

Credits

License

The MIT License

0.2.3

8 years ago

0.2.2

8 years ago

0.2.1

8 years ago

0.2.0

8 years ago

0.1.9

8 years ago

0.1.8

8 years ago

0.1.7

8 years ago

0.1.6

8 years ago

0.1.5

8 years ago

0.1.4

8 years ago

0.1.3

8 years ago

0.1.2

8 years ago

0.1.1

8 years ago

0.1.0

8 years ago