mgryszko / strava-access-token

Generate Strava API OAuth2 access token for testing
1 stars 1 forks source link
cli ruby sinatra strava

Strava access token generator

Generate Strava API OAuth2 access token for testing purposes.

Used in pet projects:

Installation

Prerequisites

Ruby executable. Tested on macOS with Homebrew Ruby environment managed by rbenv.

Homebrew

brew tap mgryszko/strava
brew install strava-access-token

Usage

strava-access-token <client_id> <client_secret>

If you don't have a client id/secret, register your app following the official Strava documentation.

The script starts a local server (acting as an OAuth2 client) listening on port 8080.

Open your http://localhost:8080/ in your browser and authenticate against Strava. Access token will be displayed in the browser and downloaded to the current working directory as .access-token .

Developer setup

Pre-requisite: install rbenv (Ruby environment), then:

# Replace '<ruby_version>' with latest 2.7 [Ruby release](https://www.ruby-lang.org/en/downloads/).
rbenv install <ruby_version>
rbenv local <ruby_version>

Run

rbenv exec ruby strava-access-token <client_id> <client_secret>