A script to create visualizations of strava rides
-
Create a Strava Application
- You will need your Client ID and Client Secret
-
Copy the url
http://www.strava.com/oauth/authorize?client_id=[REPLACE_WITH_YOUR_CLIENT_ID]&response_type=code&redirect_uri=http://localhost/exchange_token&approval_prompt=force&scope=read_all,activity:read_all
into your browser and place your Client ID in the placeholder.
-
Approve the application on the prompt and wait for the redirect url to appear.
-
When the redirect url is shown in your browser, copy the Authorization Code shown in it.
localhost/exchange_token?stat=&code=[VERY_LONG_CODE_HERE]&scope=read,activity:read_all,read_all
-
Run the
curl
request with your Client ID, Client Secret and the Authorization Code from above in your terminal.curl -X POST https://www.strava.com/oauth/token -F client_id=YOURCLIENTID -F client_secret=YOURCLIENTSECRET -F code=AUTHORIZATIONCODE -F grant_type=authorization_code
-
Create a
.env
file with the following information:REFRESH_TOKEN=<token that is given in the curl response> ACCESS_CODE=<token that is given in the curl response> CLIENT_ID=<ID given to your Strava application> CLIENT_SECRET=<secret given to your Strava application>
-
Use the
access_token
andrefresh_token
provided in the response in the.env
file. -
From the command line, run
python strava.py
. -
When the access token expires, run
auth.py
from the commandline