Adds initial README file

Adds a README file explaining the project, oAuth management, and infisical setup.

The oAuth management section describes the manual steps required to get a refresh token from Strava and how to use it.
The Infisical setup section explains how to set up the Infisical vault with the required variables.
This commit is contained in:
Louis
2025-10-26 17:30:22 +01:00
parent 929f0e38f6
commit 7f8d962edd

View File

@@ -1,3 +1,31 @@
# Strava-API
API used to communicate with my strava account, will be used as a display project
API used to communicate with my strava account, will be used as a display project
## WIP and strava oAuth management
Right now the oAuth management is a bit manual, I need to get the refresh token manually from strava website, then store it in Infisical vault (or env variable for testing).
### Steps to get refresh token
1. Go to this URL (replace client_id with your strava app client id, redirect_uri with your redirect uri, and scope with the scopes you need):
```https://www.strava.com/oauth/authorize?client_id=181987&response_type=code&redirect_uri=https://louisemard.dev&approval_prompt=force&scope=read,activity:read_all
```
2. Authorize the application and you will be redirected to the redirect_uri with a code in the URL.
3. Exchange the code for a refresh token by making a POST request to the Strava API:
```
POST https://www.strava.com/oauth/token
Content-Type: application/x-www-form-urlencoded
client_id=181987
client_secret=YOUR_CLIENT_SECRET
code=AUTHORIZATION_CODE
grant_type=authorization_code
```
4. The response will contain the refresh token, which you can then store in your Infisical vault or as an environment variable.
The `REFRESH_TOKEN` is then used by the application to get new access tokens when needed. It's linked to your Strava account and allows the application to access your data.
## Infisical setup
To use infisical you need to have the following variables in your vault (environment "dev"):
- `INFISICAL_CLIENT_SECRET`: your infisical client secret
- `INFISICAL_CLIENT_ID`: your infisical client id
- `INFISICAL_URL`: Infisical url, mine is `https://vault.louisemard.dev`
- `INFISICAL_PROJECT_ID`: Project where the secrets are stored, right now only one project is supported