Skip to main content

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.

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


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

 


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