I am trying to make an app that get strava user info (info, activities, etc...).

I read the instruction of strava doc : https://developers.strava.com/docs/authentication/

I get that on my app, I should ask the user to connect to strava using something like : https://www.strava.com/oauth/authorize?client_id=22991&redirect_uri=https://printmyroute.xyz/activity&response_type=code&scope=activity:read_all,read_all,profile:read_all

Then, a connection page appears and then an authorization. When the user accepts the authorization I got a code inside the url. Great! But to follow the doc, to make a request about activities, I need the client_id and client_secret in order to make this request :

curl -X POST https://www.strava.com/api/v3/oauth/token \
  -d client_id=ReplaceWithClientID \
  -d client_secret=ReplaceWithClientSecret \
  -d code=ReplaceWithCode \
  -d grant_type=authorization_code

But how can I get the client_id and client_secret of the user. (I can make a request using my client_id and client_secret, but this is not the goal, I'd like to access data of the user in order to display it on his app...).

Thank you

2

There are 2 best solutions below

0
On BEST ANSWER

You can find client ID and client secret in your application page.

client_id and client_secret are application parameters obtained during registration, they are not connected to user.

Please note that in this request you also use code parameter obtained when the user accepts the authorization.

After this request you get a refresh_token, which is also specific for the user.

0
On

Spep1 : Add A app on your Strava Account

Spep2 : Using Auth with cliend Id and Scerect code Spep3 : You can refresh your token next use .

you need to add an app in strava

Then need Auth 2 Authontication

enter image description here

Thanks and happy codding .