0

I'm trying to set up a web page for my sister-in-law to display her strava activities and stats, using my own web page's python code and web page as a template.

I can get her stats ok, but I get a 401 error returned when I try to get her activities. At the bottom of this message is what I get returned when I try to get her last five activities (I have replaced the Bearer code with ****).

I have her client_id, client_secret, refresh_token, access_token, athelete_id, grant_type, (authorization code) and the corrected paths for her stats file, auth file and activities file in a .env file and have double, triple and quadruple checked them for accuracy- what am I missing?

I don't understand why getting stats works, but getting activities doesn't.

My own running web page is here-

https://vk7krj.com/running.html

The stripped-down version with just the strava bits for Sue is here-

https://vk7krj.com/Sues%20running.html

Her activities are currently showing some old ones of mine as placeholders..

Any help/ideas greatly appreciated.

Ken.


root@odroid:/var/lib/strava/Sues# ./get_strava_activities.py Token has not expired, returning Getting activities https://www.strava.com/api/v3/athlete/activities?per_page=5 {'Authorization': 'Bearer xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'} Response code = 401 Token saved


Ken
  • 27
  • 6

1 Answers1

0

When you obtain the authorization code, are you using the following scope: scope=activity:read

Here's the full URL: http://www.strava.com/oauth/authorize?client_id=<client_id>&response_type=code&redirect_uri=http://localhost/exchange_token&approval_prompt=force&scope=activity:read

Also, are her activities set to allow "Everyone" to view them?

That may be the problem?

-Roger

  • 1
    Thanks Roger, yes, her activities are set to allow everyone to view them- but the scope is just scope=read. I can't see any way to change that in her account. But then, my own account is also set to the same and that works ok with exactly the same python scripts. It really has me baffled. – Ken Aug 10 '23 at 09:26