You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+61-26Lines changed: 61 additions & 26 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -255,53 +255,85 @@ The `config.yaml` contains environment variables that are internal to the Python
255
255
256
256
## Launch the API
257
257
258
+
> [!WARNING]
259
+
> Beforehand, check that your venv is activated.
260
+
261
+
### Using VS Code
262
+
263
+
1. In the activity bar (the leftmost part), click the _Run and Debug_ icon (the play button).
264
+
2. Click the green play button.
265
+
266
+
Check that your Hyperion instance is up and running by navigating to http://localhost:8000/information.
267
+
268
+
### Using the command-line interface
269
+
258
270
```bash
259
271
fastapi dev app/main.py
260
272
```
261
273
262
-
## Use Alembic migrations
274
+
Check that your Hyperion instance is up and running by navigating to http://localhost:8000/information.
263
275
264
-
See [migrations README](./migrations/README)
276
+
## Create your own user
265
277
266
-
Warning : on SQLite databases, you have to drop the database and recreate it to apply the new DDL.
278
+
There are many ways to do so, ranked here from easiest (GUI only) to hardest (CLI only).
279
+
Note that registration and activation are distinct steps, so for fun you may register one way and activate your account another way.
267
280
268
-
##OpenAPI specification
281
+
### With CalypSSO
269
282
270
-
API endpoints are parsed following the OpenAPI specifications at `http://127.0.0.1:8000/openapi.json`.
283
+
#### Registering your account
271
284
272
-
A Swagger UI is available at `http://127.0.0.1:8000/docs`. For authentication to work, a valid `AUTH_CLIENT` must be defined in the `.env`, with `http://127.0.0.1:8000/docs/oauth2-redirect` as the redirect URI, and `scope=API` must be added to the authentication request.
285
+
Go to http://localhost:8000/calypsso/register and type a valid email address to register (start the creation of) your account.
273
286
274
-
##Create the first user
287
+
#### Activating your account
275
288
276
-
You can create the first user either using Titan or calling the API directly.
289
+
Go back to the shell running your Hyperion instance, in the logs look for a link looking like http://localhost:3000/calypsso/activate?activation_token=12345.
290
+
Open it and activate (end the creation of) your account.
To activate your account you will need an activation token which will be printed in the console.
294
+
1. Click "_Se connecter_" on the login page: you land CalypSSO's login page.
295
+
2. Click "_Créer un compte_" and create your account using CalypSSO as above.
281
296
282
-
### With Titan
297
+
### Using the API through the swagger
283
298
284
-
Press "Créer un compte" on the first page and follow the process.
299
+
#### Registering your account
285
300
286
-
### Using the API directly
301
+
1. Go to http://localhost:8000/docs: this is called the _swagger_, a web interface to interact with the API, it is a layer on top of the "automatic documentation" (the _OpenAPI specification_) generated by FastAPI at http://localhost:8000/openapi.json.
302
+
2. Search `/users/create`.
303
+
3. Open it, click "Try it out".
304
+
4. Fill in your email address, and click "Execute".
287
305
288
-
Create the account:
306
+
#### Activating your account
307
+
308
+
1. Go back to the shell running your Hyperion instance, in the logs look for a link looking like http://localhost:3000/calypsso/activate?activation_token=12345.
309
+
2. Copy this activation token.
310
+
3. Go again on the swagger and search `/users/activate`.
311
+
4. Open it, click "Try it out".
312
+
5. Fill in your information, using the `activation_token` you copied (click "Schema" next to "Edit Value" so see what fields are optional), and click "Execute".
313
+
314
+
### Using the API in command line
315
+
316
+
> [!TIP]
317
+
> On Windows, `curl` is different.
318
+
> To get the same results as on Linux and MacOS:
319
+
>
320
+
> - either replace `curl` with `curl.exe`
321
+
> - or run the `curl` commands below in a bash (using WSL or using Git Bash)
1. Go back to the shell running your Hyperion instance, in the logs look for a link looking like http://localhost:3000/calypsso/activate?activation_token=12345.
0 commit comments