Skip to main content
Solved

API activity request with refresh capability for access token

  • February 22, 2023
  • 3 replies
  • 36 views

Forum|alt.badge.img+6

I am unable to retrieve my activities via my React application, despite using this how-to site for reference and largely copying the code over: https://javascript.plainenglish.io/strava-api-react-app-326e63527e2c. Is this not a valid request link: 

https://www.strava.com/api/v3/athlete/activities?access_token=<access_token_here>? Of course, that <access_token_here> part is where my current access token would be, which gets refreshed with the way I've set up my React App.js file. 
 
For extra context, I am receiving a 401 request error upon the request being made in React:
The underlying error appears to be the following:

Not sure how to interpret this result.

 
I'd appreciate any help/insight into this for those of you who are aware of a fix/solution and/or have gone through this problem already.

Best answer by reesmonty

It turned out I just didn't have the right refresh token. Once I had that, everything worked as expected and I was able to pull in data to my React app.

View original
Did this topic help you find an answer to your question?

3 replies

Forum|alt.badge.img+3
  • Hub Rookie
  • 1 reply
  • February 24, 2023

The access token does not go in the URL of the GET request, it goes in the 'Authorization' HTTP header of the request.

Read more here


ActivityFix
Superuser
Forum|alt.badge.img+24
  • Superuser
  • 232 replies
  • February 24, 2023

The error message says you don't have read permissions. As part of the oauth flow you pass the requested scopes and the athlete can accept whichever ones they feel are appropriate. See https://developers.strava.com/docs/authentication/#detailsaboutrequestingaccess. The token you acquire will only grant access to the scopes the athlete authorized, so make sure you have either read or read_all

 


Forum|alt.badge.img+6
  • Author
  • Hub Rookie
  • 5 replies
  • Answer
  • February 25, 2023

It turned out I just didn't have the right refresh token. Once I had that, everything worked as expected and I was able to pull in data to my React app.


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept, you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings