📝」 doc(auth): should be complete

This commit is contained in:
2025-09-01 19:35:37 +02:00
parent 4c4b9ca5ef
commit 98a6b50fd0
4 changed files with 156 additions and 11 deletions

View File

@ -0,0 +1,68 @@
# 2fa
Abailable endpoints:
- POST `/2fa`
- POST `/2fa/verify`
- DELETE `/2fa`
Common return:
- 500 with response
```json
{
"error": "Internal server error"
}
```
## POST `/2fa`
Used to enable 2fa (need to verify after to confirm)
Inputs: just need a valid JWT cookie
Returns:
- 200
```json
{
"secret": "<the generated secret>"
"otpauthUrl": "<the generated url>"
}
```
## POST `/2fa/verify`
Used to confirm 2fa
Inputs: a valid JWT in cookie and
```json
{
"token": "<token given by 2fa>"
}
```
Returns:
- 200
```json
{
"msg": "2FA verified successfully"
}
```
- 401 || 400 || 404
```json
{
"error": "<corresponding error>"
}
```
## DELETE `/2fa`
Used to remove 2fa
Inputs: a valid JWT in cookie
Returns:
- 200
```json
{
"msg": "TOTP removed"
}
```