Skip to content
This repository was archived by the owner on Feb 6, 2024. It is now read-only.

Commit 1b8d4c5

Browse files
doc: api docs
1 parent b38bdd7 commit 1b8d4c5

File tree

1 file changed

+63
-0
lines changed

1 file changed

+63
-0
lines changed

studio/docs/api.md

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# APIs
2+
3+
## List of endpoints
4+
5+
| Endpoint | Guard | Details | Frontend`*` | Backend`*` |
6+
|---|---|---|---|---|
7+
| login | X | [Link](#login) | | |
8+
| logout | X | [Link](#logout) | | |
9+
| decks | X | | | |
10+
| slides | X | | | |
11+
| publish | X | | | |
12+
| feed | | | | |
13+
14+
`*`: already implemented in
15+
16+
### Login
17+
18+
| <!-- --> | <!-- --> |
19+
|-------------|-------------|
20+
| Title | Login |
21+
| Description | Verify Google ID Token, create or update user, convert anonymous data to "real" user |
22+
| Reference | [https://firebase.google.com/docs/auth/admin/verify-id-tokens](https://firebase.google.com/docs/auth/admin/verify-id-tokens) |
23+
| Method | Post |
24+
| Body | token (?) |
25+
| Success Response | `{backend_token: string}` |
26+
27+
* User data sample:
28+
29+
```
30+
export interface User {
31+
token: string;
32+
33+
anonymous: boolean;
34+
35+
name?: string;
36+
email?: string;
37+
email_verified?: boolean;
38+
photo_url?: string;
39+
40+
created_at: Date;
41+
updated_at: Date;
42+
}
43+
```
44+
45+
* Notes
46+
47+
- If *verify-id-tokens* from Google doesn't return user data on the backend side, user data has to be provided as body of the request
48+
49+
- `backend_token` is the token to be provided in each guarded backend routes
50+
51+
### Logout
52+
53+
| <!-- --> | <!-- --> |
54+
|-------------|-------------|
55+
| Title | Logout |
56+
| Description | Invalidate backend token |
57+
| Method | Post |
58+
| Body | token (?) |
59+
60+
* Notes
61+
62+
- should we also add a status on the user data and therefore set the status to `inactive` or else on logout?
63+

0 commit comments

Comments
 (0)