July 2017
Beginner to intermediate
340 pages
7h 43m
English
The missing part of the puzzle to make those Strava imports work is to get a Strava token for each user and store it in our user table.
As said earlier, this can be done via an OAuth2 dance where the connected user is redirected to Strava to authorize Runnerly, then redirected back to Runnerly with an OAuth2 code that can be converted into a token we can store.
The stravalib library provides some helpers to perform that dance. The first one is the authorization_url() method, which returns a full URL that can be presented to the users to initiate the OAuth2 dance:
app.config['STRAVA_CLIENT_ID'] = 'runnerly-strava-id' app.config['STRAVA_CLIENT_SECRET'] = 'runnerly-strava-secret' def get_strava_auth_url(): client = Client() ...Read now
Unlock full access