1.0.0 • Published 6 years ago
passport-autoconfigurator2 v1.0.0
passport-autoconfigurator
passport-autoconfigurator is a utility to reduce code when you need to use passport.
Install
npm install replace -g
You can now use passport-autoconfigurator
as npm module in your project
Usage
var GooglePasssportAutoconfigurator = require('./src/main/server/authentication/GooglePasssportAutoconfigurator.js');
var options = {
google: {
client: {
id: '3195027c-6673-4209-83e0-e32e2f402f16.apps.googleusercontent.com',
secret: '8a140a26-0542-11e8-ba89-0ed5f89f718b',
callbackUrl: 'http://localhost:8080/auth/google/callback'
}
},
express : {
callbackRoute : '/auth/google/callback',
failureRedirect : '/login'
},
session: {
secret: '8a13ff04-0542-11e8-ba89-0ed5f89f718b'
}
}
//this will set a user object(google profile) in request in case of success login
var googlePasssportAutoconfigurator = new GooglePasssportAutoconfigurator(options, app);
//secure '/' route using ensureAuthenticated function
app.get('/',googlePasssportAutoconfigurator.ensureAuthenticated, function(req, res,next) {
next();
});
1.0.0
6 years ago