cancel
Showing results for 
Search instead for 
Did you mean: 
Announcements

The Hub is now in read-only mode as we make improvements to the Hub experience. More information is available here.

401 Error

Jamzy
Mt. Kenya

I'm extremely new to this but after trying to get anything to work for 3 hours I thought I'd ask here.

I'm trying to get activity data for a Python project. I've followed all the steps on the getting started doc and now I'm trying to use the requests module in Python to get activity information.

Why isn't this working?

import requests

access_token = ""

headers = {"Authorization" : f"Bearer {access_token}"}

response = requests.get("https://www.strava.com/api/v3/athlete/activities", headers=headers)
print(response)
print(response.text)

I just keep getting:
<Response [401]>
{"message":"Authorization Error","errors":[{"resource":"Athlete","field":"access_token","code":"invalid"}]}



Really grateful for any help on this I'm completely lost 😕
1 ACCEPTED SOLUTION

kanoor
Mt. Kenya

check access token use new access token if its expires ... access token expires every 6hr

View solution in original post

3 REPLIES 3

jervinjosh68
Mt. Kenya

Encountering the same problem also. I can't authorize(?) my token when using local host

jhoney12
Shkhara
I am also facing the same problem
 
jhoney12_0-1705396601718.png

 

kanoor
Mt. Kenya

check access token use new access token if its expires ... access token expires every 6hr