Skip to content

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

Notifications You must be signed in to change notification settings

shuhei/passport-untappd

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

passport-untappd

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

Install

$ npm install passport-untappd

Usage

Configure Strategy

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

passport.use(new UntappdStrategy({
  clientID: 'UNTAPPD_CLIENT_ID',
  clientSecret: 'UNTAPPD_CLIENT_SECRET',
  callbackURL: 'https://www.example.net/auth/untappd/callback'
}, function(accessToken, refreshToken, profile, done) {
  User.findOrCreate({ untappdId: profile.id }, function(err, user) {
    done(err, user);
  });
});

Authenticate Requests

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

For example, as route middleware in an Express application:

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

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

Credit

License

The MIT License

Copyright (c) 2015 Shuhei Kagawa

About

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

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published