Skip to content

Commit cedab8a

Browse files
committed
update
1 parent cd3ad2a commit cedab8a

1 file changed

Lines changed: 21 additions & 3 deletions

File tree

docs/AUTHENTICATION.md

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,17 @@ bin2hex(random_bytes(32))
369369

370370
#### Step 1: Login (Get Token)
371371

372-
The API accepts login credentials in **3 formats**:
372+
The API accepts login credentials in **3 different formats**:
373+
374+
| Format | Content-Type | Is JSON? | Use Case |
375+
|--------|-------------|----------|----------|
376+
| **JSON** | `application/json` | ✅ Yes | Modern APIs, JavaScript apps |
377+
| **Form Data** | `application/x-www-form-urlencoded` | ❌ No | Traditional HTML forms |
378+
| **Multipart** | `multipart/form-data` | ❌ No | File uploads |
379+
380+
**Important:** Only Option 1 (JSON) uses actual JSON format!
381+
382+
---
373383

374384
##### Option 1: JSON Body (Recommended for Modern APIs)
375385

@@ -401,7 +411,9 @@ http POST http://localhost/api.php action==login username=john password=SecurePa
401411

402412
---
403413

404-
##### Option 2: Form Data (application/x-www-form-urlencoded)
414+
##### Option 2: Form Data (URL-encoded, NOT JSON)
415+
416+
**Format:** `application/x-www-form-urlencoded` (traditional HTML form format)
405417

406418
**cURL:**
407419
```bash
@@ -417,11 +429,15 @@ POST http://localhost/api.php?action=login
417429
Body → x-www-form-urlencoded:
418430
username: john
419431
password: SecurePass123!
432+
433+
(This is NOT JSON - it's the same format as URL query parameters)
420434
```
421435

422436
---
423437

424-
##### Option 3: Multipart Form Data
438+
##### Option 3: Multipart Form Data (for file uploads, NOT JSON)
439+
440+
**Format:** `multipart/form-data` (used when uploading files)
425441

426442
**cURL:**
427443
```bash
@@ -438,6 +454,8 @@ POST http://localhost/api.php?action=login
438454
Body → form-data:
439455
username: john
440456
password: SecurePass123!
457+
458+
(This is NOT JSON - it's a multipart format for file uploads)
441459
```
442460

443461
---

0 commit comments

Comments
 (0)