Latest Threat ResearchGlassWorm Loader Hits Open VSX via Developer Account Compromise.Details
Socket
Book a DemoInstallSign in
Socket

passport-phonegap-build

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

passport-phonegap-build

PhoneGap Build authentication strategy for Passport.

latest
Source
npmnpm
Version
0.0.1
Version published
Maintainers
1
Created
Source

Passport-PhoneGap-Build

Passport strategy for authenticating with PhoneGap Build using the OAuth 2.0 API.

This module lets you authenticate using GitHub in your Node.js applications. By plugging into Passport, GitHub authentication can be easily and unobtrusively integrated into any application or framework that supports Connect-style middleware, including Express.

Install

$ npm install passport-phonegap-build

Usage

Configure Strategy

passport.use(new PhonegapBuildStrategy({
    clientID: CLIENT_ID,
    clientSecret: CLIENT_SECRET,
    callbackURL: "http://127.0.0.1:3000/auth/phonegap/callback"
  },
  function(accessToken, refreshToken, profile, done) {
    User.findOrCreate({ id: profile.id }, function (err, user) {
      return done(err, user);
    });
  }
));

Authenticate Requests

Use passport.authenticate(), specifying the 'phonegap-build' strategy, to authenticate requests.

For example, as route middleware in an Express application:

app.get('/auth/phonegap-build',
  passport.authenticate('phonegap-build'));

app.get('/auth/phonegap-build/callback', 
  passport.authenticate('phonegap-build', { failureRedirect: '/login' }),
  function(req, res) {
    // Successful authentication, redirect home.
    res.redirect('/');
  });

Credits

Inspired by Jared Hanson's Github Strategy:

  • Jared Hanson

License

The MIT License

Keywords

passport

FAQs

Package last updated on 05 Jan 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts