Skip to content

CityStrides/omniauth-strava-oauth2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OmniAuth Strava

Note: This is an un-modified copy of the code for the omniauth-strava-oauth2 gem because the code for that gem has gone missing.

This is the official OmniAuth strategy for authenticating to GitHub. To use it, you'll need to sign up for an OAuth2 Application ID and Secret on the Strava Applications Page.

Basic Usage

use OmniAuth::Builder do
  provider :strava, ENV['STRAVA_KEY'], ENV['STRAVA_SECRET']
end

Scopes

Strava API v3 lets you set scopes to provide granular access to different types of data:

use OmniAuth::Builder do
  provider :strava, ENV['STRAVA_KEY'], ENV['STRAVA_SECRET'], scope: "public"
end

Auth Hash

Here is an example Auth Hash in request.env['omniauth.auth']

{
  "provider" => "strava",
  "uid" => 12345678,
  "info" => {
    "firstname" => "Strava",
  },
  "credentials" => {
    "token" => "123-321",
    "expires" => false
  },
  "extra" => {
    "raw_info" => {
      "id" => 12345678,
      "firstname" => "Strava Athlete",
    }
  }
}

More info on Scopes.

License

Add license here.