Skip to content

derrickpelletier/passport-strava

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Passport-Strava

Passport strategy for authenticating with Strava's API V3 using OAuth2.

I used Passport-github as the base for this repo. Really I just changed a few things, the real work was already done.

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

Install

$ npm install passport-strava

Usage

Create an Application

To use passport-strava you must register an application with Strava in the settings panel. You will be issued a client ID and a client secret to configure your strategy.

Configure Strategy

There are numerous examples available on setting up passport strategies:

Simple config example:

var StravaStrategy = require('passport-strava').Strategy;

passport.use(new StravaStrategy({
    clientID: STRAVA_CLIENT_ID,
    clientSecret: STRAVA_CLIENT_SECRET,
    callbackURL: "http://127.0.0.1:3000/auth/strava/callback"
  },
  function(accessToken, refreshToken, profile, cb) {
    User.findOrCreate({ stravaId: profile.id }, function (err, user) {
      return cb(err, user);
    });
  }
));

The returned profile object will contain the entire JSON response specified in Strava's api documentation.

About

Passport auth module for Strava API

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published