1.0.0 • Published 8 years ago

passport-ucoz v1.0.0

Weekly downloads
1
License
-
Repository
github
Last release
8 years ago

passport-ucoz

Install

$ npm install passport-ucoz

Authenticate Requests

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('/');
  });

Examples

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);
    });
  }
));

Tests

$ npm install
$ npm test

Credits

License

The MIT License

Copyright (c) 2015 Maxim Jarusov