Hi! I have been trying to set up an API that will extract activity data based on dates.
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:
- Enter the above URL with my client ID into my browser. After clicking accept, I got "this site cannot be reached" as expected
- In postman:
- Set request type to POST
- URL = https://www.strava.com/oauth/token
- 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
- 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.
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
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.
Get Client ID and Client Secret
- After creating the application, you will get a Client ID and Client Secret.
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.
Reply
Login to the community
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.