docs
This commit is contained in:
26
docs/api/routes/auth/login.md
Normal file
26
docs/api/routes/auth/login.md
Normal file
@@ -0,0 +1,26 @@
|
||||
# `POST /auth/login`
|
||||
|
||||
Public. No cookie required.
|
||||
|
||||
**Body (JSON)**
|
||||
|
||||
```json
|
||||
{ "idToken": "<google-id-token>" }
|
||||
```
|
||||
|
||||
**200**
|
||||
|
||||
```json
|
||||
{
|
||||
"message": "Login successful",
|
||||
"user": { "id": 1, "email": "you@example.com", "picture": "https://lh3.googleusercontent.com/..." }
|
||||
}
|
||||
```
|
||||
|
||||
**Errors**
|
||||
|
||||
| Status | Body |
|
||||
|--------|------|
|
||||
| 400 | `{ "error": "idToken is required" }` or `{ "error": "GOOGLE_CLIENT_ID is not configured" }` |
|
||||
| 401 | `{ "error": "Invalid Google token" }` or `{ "error": "Invalid Google account" }` |
|
||||
| 403 | `{ "error": "Email is not authorized" }` |
|
||||
9
docs/api/routes/auth/logout.md
Normal file
9
docs/api/routes/auth/logout.md
Normal file
@@ -0,0 +1,9 @@
|
||||
# `POST /auth/logout`
|
||||
|
||||
Public. Clears the session cookie.
|
||||
|
||||
**200**
|
||||
|
||||
```json
|
||||
{ "message": "Logged out successfully" }
|
||||
```
|
||||
19
docs/api/routes/auth/me.md
Normal file
19
docs/api/routes/auth/me.md
Normal file
@@ -0,0 +1,19 @@
|
||||
# `GET /auth/me`
|
||||
|
||||
Protected. Requires a valid session cookie. Every response includes `googleClientId`.
|
||||
|
||||
**200**
|
||||
|
||||
```json
|
||||
{
|
||||
"user": { "id": 1, "email": "you@example.com", "picture": "https://lh3.googleusercontent.com/..." },
|
||||
"googleClientId": "your-client-id.apps.googleusercontent.com"
|
||||
}
|
||||
```
|
||||
|
||||
**Errors**
|
||||
|
||||
| Status | Body |
|
||||
|--------|------|
|
||||
| 401 | `{ "error": "Unauthorized", "googleClientId": "..." }` or `{ "error": "Invalid token", "googleClientId": "..." }` |
|
||||
| 403 | `{ "error": "User is no longer authorized", "googleClientId": "..." }` |
|
||||
Reference in New Issue
Block a user