mirror of
https://github.com/KeyZox71/knl_meowscendence.git
synced 2025-10-14 02:54:44 +02:00
「📝」 doc(auth): should be complete
This commit is contained in:
@ -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"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
@ -1,6 +1,65 @@
|
|||||||
# Login
|
# Login
|
||||||
|
|
||||||
Abailable endpoints:
|
Abailable endpoints:
|
||||||
- `/login`
|
- POST `/login`
|
||||||
- `/login/google`
|
- GET `/login/google`
|
||||||
- `/login/google/callback`
|
- GET `/login/google/callback`
|
||||||
|
|
||||||
|
Common return:
|
||||||
|
- 500 with response
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"error": "Internal server error"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## POST `/login`
|
||||||
|
|
||||||
|
Used to login
|
||||||
|
|
||||||
|
Input needed :
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"user": "<string>",
|
||||||
|
"password": "<string>"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
Can return:
|
||||||
|
- 200 with response and cookie in header
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"msg": "Login successfully"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
- 400 with response
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"error": "<corresponding error>"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## GET `/login/google`
|
||||||
|
|
||||||
|
Used to redirect the user to the login page for google auth
|
||||||
|
|
||||||
|
Always return:
|
||||||
|
- redirect to the google auth url
|
||||||
|
|
||||||
|
## GET `/login/google/callback`
|
||||||
|
|
||||||
|
Used to get the callback from google and confirm the login
|
||||||
|
|
||||||
|
Can return:
|
||||||
|
- 400 with response
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"error": "<corresponding error>"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
- 200 with response and cookie in header
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"msg": "Login successfully"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
5
doc/auth/me.md
Normal file
5
doc/auth/me.md
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
GET `/me`
|
||||||
|
|
||||||
|
Inputs : just need the JWT cookie
|
||||||
|
|
||||||
|
Returns the user of the account
|
@ -1,9 +1,9 @@
|
|||||||
# Register
|
# Register
|
||||||
|
|
||||||
Available endpoints:
|
Available endpoints:
|
||||||
- `/register`
|
- POST `/register`
|
||||||
- `/register/google`
|
- GET `/register/google`
|
||||||
- `/register/google/callback`
|
- GET `/register/google/callback`
|
||||||
|
|
||||||
Common return:
|
Common return:
|
||||||
- 500 with response
|
- 500 with response
|
||||||
@ -13,7 +13,9 @@ Common return:
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
## `/register`
|
## POST `/register`
|
||||||
|
|
||||||
|
Used to register
|
||||||
|
|
||||||
Input needed :
|
Input needed :
|
||||||
```json
|
```json
|
||||||
@ -37,16 +39,27 @@ Can return:
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
## `/register/google`
|
## GET `/register/google`
|
||||||
|
|
||||||
Does not take input
|
Used to redirect to the google auth page
|
||||||
|
|
||||||
Always return:
|
Always return:
|
||||||
- redirect to the google auth url
|
- redirect to the google auth url
|
||||||
|
|
||||||
## `/register/google/callback`
|
## GET `/register/google/callback`
|
||||||
|
|
||||||
inputs are filled by google
|
Used to get the callback from google and register
|
||||||
|
|
||||||
Can return:
|
Can return:
|
||||||
- 400 with response
|
- 400 with response
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"error": "<corresponding error>"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
- 200 with response and cookie in header
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"msg": "Register successfully"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
Reference in New Issue
Block a user