July 2017
Beginner to intermediate
340 pages
7h 43m
English
Strava provides a typical three-legged OAuth2 implementation, and stravalib (https://github.com/hozn/stravalib), all the tools to use it.
Implementing the dance is done by redirecting the user to Strava and exposing an endpoint the user is redirected to once granted access to Strava.
What we get in return is the user info from its Strava account along with the token access. We can store all this info in the Flask session, use it as our login mechanism, and pass the e-mail and token values to DataService so that the Celery strava worker can also use the token.
Like we did in Chapter 4, Designing Runnerly, let's implement the function that generates the URL to send the user to, as follows:
from stravalib.client import ...