Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ajouter documentation sur la génération de clé api #540

Merged
merged 1 commit into from
Aug 7, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 18 additions & 2 deletions back/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ cp ../.env.sample ./env
pnpm fullcheck
```

You can run in watch mode individually :
You can run in watch mode individually :

Unit tests :

Expand Down Expand Up @@ -51,7 +51,7 @@ Integration tests :
```

5. You can run create some data in the database with :
You will than have the correct featureFlags and an agency in Paris.
You will than have the correct featureFlags and an agency in Paris.

```
pnpm seed
Expand Down Expand Up @@ -136,6 +136,22 @@ The back-end behaviour is controlled by environment variables. They can be speci
back$ pnpm start
```

### Creating a JWT token for public api use by partners

To generate a token for a partner:

1. add the partner name to `authorisedNames` in shared/src/apiConsumer/ApiConsumer.ts
2. run the script `generateApiKey` in Scalingo one-off container :

```bash
scalingo --app if-prod-back --region osc-secnum-fr1 run 'pnpm back run generate-api-key <company-name>'
```

3. the JWT token will then be printed on your screen and should be shared to the partner. You can also find it in DB table `api_consumers`.

4. an sql command to insert data into `api_consumers` will also be printed on screen and should be executed manually. It
will authorize this new consumer to access the api.

### Controlling the log output

To change the **granularity of the log output**, use the `LOG_LEVEL` environment variable. Valid values in descending order of granularity are: `fatal`, `error`, `warn`, `info` (default), `debug`, `trace`.
Expand Down