$ npm install passport-ucoz
Use passport.authenticate()
, specifying the 'ucoz'
strategy, to
authenticate requests.
For example, as route middleware in an Express application:
app.get('/auth/ucoz',
passport.authenticate('ucoz'));
app.get('/auth/ucoz/callback',
passport.authenticate('ucoz', { failureRedirect: '/login' }),
function(req, res) {
// Successful authentication, redirect home.
res.redirect('/');
});
passport.use(new UcozStrategy({
consumerKey: UCOZ_CONSUMER_KEY,
consumerSecret: UCOZ_CONSUMER_SECRET,
callbackURL: "http://127.0.0.1:3000/auth/ucoz/callback"
},
function(req, accessToken, tokenSecret, profile, done) {
User.findOrCreate({ userId: profile.id }, function (err, user) {
return done(err, user);
});
}
));
$ npm install
$ npm test
Copyright (c) 2015 Maxim Jarusov