passport-uber-v2

0.1.1 • Public • Published

Passport-uber-v2

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

This module lets you authenticate using Uber in your Node.js Express (or Connect) server applications.

Install

$ npm install passport-uber-v2

Usage

Configure Strategy

The Uber authentication strategy authenticates users using an Uber account and OAuth tokens. The strategy requires a verify callback, which accepts these credentials and calls done providing a user, as well as options specifying a client id , client secret, and callback URL.

var uberStrategy = require('passport-uber-v2').Strategy;
 
passport.use(new uberStrategy({
    clientID: CLIENT_ID,
    clientSecret: CLIENT_SECRET,
    callbackURL: 'http://localhost:3000/callback'
  },
  function(accessToken, refreshToken, profile, done) {
    var user = profile;
    user.accessToken = accessToken;
    return done(null, user);
  }
));

Authenticate Requests

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

For example, as route middleware in an Express application:

app.get('/auth/uber',
  passport.authenticate('uber', { scope: ['profile'] }
));
 
app.get('/callback', passport.authenticate('uber', { failureRedirect: '/login' }),
  function(req, res) {
    res.redirect('/');
});

License

The MIT License

Copyright (c) 2016 Tomomi ❤ Imura <http://girliemac.com>

Package Sidebar

Install

npm i passport-uber-v2

Weekly Downloads

0

Version

0.1.1

License

MIT

Last publish

Collaborators

  • girlie_mac