passport-cloudup
Cloudup authentication for Passport (http://passportjs.org)
Last updated 6 years ago by stevelacy .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install passport-cloudup 
SYNC missed versions from official npm registry.

passport-cloudup

Build Status NPM version

Cloudup authentication for Passport

This module is based off passport-github

Install

$ npm install passport-cloudup --save

Usage

Configure Strategy

Cloudup uses OAuth 2.0 tokens to authenticate a registered Cloudup user. The returned profile contains the full Cloudup API user data.


passport.use(new cloudupStrategy({
  clientID: clientID,
  clientSecret: clientSecret,
  callbackURL: "/auth/cloudup/callback"
},
function(accessToken, refreshToken, profile, done){

  User.findOrCreate({cloudupId: profile.id}, function (err, user) {
    return done(err, user);
  });

}));

Authenticate Requests

Using express or connect-like middleware, specify the auth type of cloudup


app.get('/auth/cloudup', passport.authenticate('cloudup'));

app.get('/auth/cloudup/callback',
  passport.authenticate('cloudup'), function(req, res){
    if (req.user){
      res.redirect('/');
    }
    else {
      res.redirect('/login');
    }
  }
);

Examples

A full authentication example can be found here

Tests

$ npm install --dev
$ npm test

LICENSE MIT

Current Tags

  • 0.1.0                                ...           latest (6 years ago)

3 Versions

  • 0.1.0                                ...           6 years ago
  • 0.0.2                                ...           6 years ago
  • 0.0.1                                ...           6 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (1)
Dev Dependencies (2)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |