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.

API Registration Issues

SpillerGray
Mt. Kenya

Hi! I have been trying to set up an API that will extract activity data based on dates. 

Unfortunately, I have been experiencing issues with the API registration.
I have been following the guide (in the api guidelines) step by step but I keep coming to an error at step 11 (link to steps here: https://developers.strava.com/docs/getting-started/)
When I input my version of the link (same exact link I have checked.. a lot..) shown in the screenshot (using postman), I am returned a 404 error message.
The only difference from the tutorial that I get when going through the steps is at step 6. If you look at the screenshot (right below step 6) you will see that the user has the opportunity to check a box saying "view data about your activities". I am not shown this box, I only see the first one "view data about your public profile (required)".
Some help on how to do this would be awesome!
Thanks. 
2 REPLIES 2

celvinpieterson
Mt. Kenya

It sounds like you're encountering issues with the Strava API authorization process. The 404 error at step 11 typically indicates that the URL you're using is incorrect or that there's an issue with the API endpoint you're trying to access. Let's go through the steps to ensure everything is set up correctly.

Step-by-Step Guide to Strava API Authorization

  1. Create a Strava Application

    • Go to the Strava API Application settings page: Strava API Applications
    • Click "Create & Manage Your App" and fill in the necessary details.
  2. Get Client ID and Client Secret

    • After creating the application, you will get a Client ID and Client Secret.
  3. Authorization URL

    • Construct the authorization URL as follows

 

https://www.strava.com/oauth/authorize?client_id=YOUR_CLIENT_ID&response_type=code&redirect_uri=YOUR_REDIRECT_URI&approval_prompt=force&scope=read,activity:read
​

 

    • Ensure you replace YOUR_CLIENT_ID with your actual Client ID and YOUR_REDIRECT_URI with your redirect URI.
  • User Authorization

    • Navigate to the authorization URL in a browser. The user will be prompted to authorize the app and grant permissions.
    • After authorization, the user will be redirected to the specified redirect_uri with a code parameter.
  • Exchange Authorization Code for Access Token

    • Use Postman or a similar tool to send a POST request to exchange the authorization code for an access token.

ActivityFix
Superuser
Superuser

For Step 6, the checkboxes shown will vary based on the scopes you request. I believe since the original documentation was written Strava has added additional scopes so the screenshot no longer matches the URL. Scopes are listed @ https://developers.strava.com/docs/authentication/#detailsaboutrequestingaccess. To get an equivalent set of checkboxes to the image you would need read and activity:read, so your URL would be:

http://www.strava.com/oauth/authorize?client_id=[REPLACE_WITH_YOUR_CLIENT_ID]&response_type=code&redirect_uri=http://localhost/exchange_token&approval_prompt=force&scope=activity%3Aread%2Cread

As to the 404 error, I'm not sure what to tell you on that one. I just tested it locally with postman and it worked fine for me. In case it helps, the exact steps I followed:

  1. Enter the above URL with my client ID into my browser. After clicking accept, I got "this site cannot be reached" as expected
  2. In postman:
    1. Set request type to POST
    2. URL = https://www.strava.com/oauth/token
    3. Set query params as shown in the image on the API guide. There are 4 total parameters:
      • client_id and client_secret come from https://www.strava.com/settings/api (you need to click "show" for your client_secret).
      • code is the value in the URL you ended up with after step 1.
      • grant_type = authorization_code
    4. Click send. You should get back a valid response.

One other thought, although I don't think it matters for this step, is to edit your app (in Strava) to have its Authorization Callback Domain set to localhost.