Skip to main content
Answer

Unable to /get/activities

  • September 24, 2023
  • 1 reply
  • 140 views

Forum|alt.badge.img+4

Hello,

I assume I'm making a newbie mistake, but can't seem to see where the issue lies.

1. I made a successful request to https://www.strava.com/api/v3/oauth/token
where I receive the following response

{
token_type: 'Bearer',
expires_at: 1695548372,
expires_in: 20715,
refresh_token: '123abc', // replacing real values
access_token: '456def', // replacing real values
athlete: {
      id: ...,
   }
}
2. I then take the access_token to get activity like:
curl https://www.strava.com/api/v3/athlete/activities -H “Authorization: Bearer 456def”

where I then get the following error: 
{"message":"Authorization Error","errors":[{"resource":"Athlete","field":"access_token","code":"invalid"}]}curl: (6) Could not resolve host: Bearer
curl: (6) Could not resolve host: 456def”

I also have a follow up question, what is the difference between the access token I recieve when authorizing via OAuth (above query) and the access token I have in my developer settings on my Strava developer profile?

Best answer by finessevanes

Update: I can make the call with the following:

fetch(apiUrl, {
method: 'GET',
headers: {
'Authorization': `Bearer ${tempAccessToken}`,
'Content-Type': 'application/x-www-form-urlencoded',
}
})

1 reply

Forum|alt.badge.img+4
  • Author
  • Hub Rookie
  • Answer
  • September 24, 2023

Update: I can make the call with the following:

fetch(apiUrl, {
method: 'GET',
headers: {
'Authorization': `Bearer ${tempAccessToken}`,
'Content-Type': 'application/x-www-form-urlencoded',
}
})