feat(docs): Update README with new registration and email confirmation details

- Added phone number field to the registration example in the API documentation.
- Included detailed response structure for registration and email verification endpoints.
- Updated email confirmation example to use email instead of userId for clarity.
- Enhanced two-factor authentication response to include manual entry key and recovery codes.
This commit is contained in:
Ho Ngoc Hai
2026-01-13 19:07:39 +07:00
parent 7d4958ec92
commit aafa1ae839
4 changed files with 115 additions and 13 deletions

View File

@@ -153,10 +153,25 @@ curl -X POST http://localhost:5001/api/v1/auth/register \
"email": "user@example.com",
"password": "Password123!",
"firstName": "John",
"lastName": "Doe"
"lastName": "Doe",
"phoneNumber": "+84901234567"
}'
```
**Response:**
```json
{
"success": true,
"data": {
"userId": "8083b412-5040-4b74-baf0-5cb709861957",
"email": "user@example.com",
"fullName": "John Doe"
},
"error": null,
"pagination": null
}
```
### Step 2: Login (Password Grant)
```bash
@@ -173,11 +188,11 @@ curl -X POST http://localhost:5001/connect/token \
**Response:**
```json
{
"access_token": "eyJhbGciOiJSUzI1NiIs...",
"access_token": "eyJhbGciOiJSUzI1NiIsImtpZCI6IjlGMzk1RDQzMDIz...",
"token_type": "Bearer",
"expires_in": 900,
"refresh_token": "eyJhbGciOiJSUzI1NiIs...",
"scope": "openid profile email offline_access"
"refresh_token": "5B8FB8189575241FF63C32ED2D0D492B32DA533B...",
"scope": "api email offline_access openid profile"
}
```
@@ -231,17 +246,29 @@ curl -X POST http://localhost:5001/connect/token \
```bash
curl -X POST http://localhost:5001/api/v1/auth/send-verification-email \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{"email": "user@example.com"}'
```
**Response:**
```json
{
"success": true,
"data": {
"success": true,
"message": "Verification email sent successfully."
},
"error": null,
"pagination": null
}
```
### Confirm Email
```bash
curl -X POST http://localhost:5001/api/v1/auth/confirm-email \
-H "Content-Type: application/json" \
-d '{"userId": "user-guid", "token": "confirmation-token"}'
-d '{"email": "user@example.com", "token": "confirmation-token-from-email"}'
```
## Two-Factor Authentication (2FA)
@@ -258,10 +285,23 @@ curl -X POST http://localhost:5001/api/v1/auth/2fa/enable \
{
"success": true,
"data": {
"secretKey": "JBSWY3DPEHPK3PXP",
"qrCodeBase64": "data:image/png;base64,...",
"recoveryCodes": ["code1", "code2", "code3", ...]
}
"qrCodeBase64": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAooAAAKK...",
"manualEntryKey": "3R36NBSHHFGRTZLMNSOH5Q2FPETPRYMP",
"recoveryCodes": [
"KEJF-MPAY",
"URMF-YRVX",
"GPK4-G9WX",
"LS34-FNP8",
"WRM0-WAML",
"QY5W-VVER",
"AIEU-GLD6",
"FDJL-3HNY",
"J1MC-JXXT",
"8GVA-OAAM"
]
},
"error": null,
"pagination": null
}
```

View File

@@ -41,7 +41,7 @@
"SyncTimeout": 5000
},
"Jwt": {
"Secret": "your-super-secret-key-min-32-characters",
"Secret": "goodgo-iam-service-secret-key-32chars!",
"Issuer": "goodgo-platform",
"Audience": "goodgo-services",
"AccessTokenExpiryMinutes": 15,

View File

@@ -6,6 +6,29 @@
"Microsoft.EntityFrameworkCore": "Warning"
}
},
"Serilog": {
"MinimumLevel": {
"Default": "Information",
"Override": {
"Microsoft": "Warning",
"Microsoft.EntityFrameworkCore": "Warning",
"System": "Warning"
}
},
"WriteTo": [
{
"Name": "Console",
"Args": {
"outputTemplate": "[{Timestamp:HH:mm:ss} {Level:u3}] {Message:lj} {Properties:j}{NewLine}{Exception}"
}
}
],
"Enrich": [
"FromLogContext",
"WithMachineName",
"WithThreadId"
]
},
"AllowedHosts": "*",
"ConnectionStrings": {
"DefaultConnection": "Host=ep-holy-glitter-a4hongg7-pooler.us-east-1.aws.neon.tech;Port=5432;Database=storage_service;Username=neondb_owner;Password=npg_Ssfy6HKO0cXI;SSL Mode=Require"
@@ -35,5 +58,20 @@
"TimeoutSeconds": 30,
"CacheDurationSeconds": 300,
"HealthCheckCacheDurationSeconds": 60
},
"Redis": {
"Host": "167.114.174.113",
"Port": 6379,
"Password": "Velik@2026",
"Database": 0,
"ConnectTimeout": 5000,
"SyncTimeout": 5000
},
"Jwt": {
"Secret": "goodgo-iam-service-secret-key-32chars!",
"Issuer": "goodgo-platform",
"Audience": "goodgo-services",
"AccessTokenExpiryMinutes": 15,
"RefreshTokenExpiryDays": 7
}
}

View File

@@ -32,11 +32,35 @@
"ConnectionStrings": {
"DefaultConnection": "Host=localhost;Port=5432;Database=myservice_db;Username=postgres;Password=postgres"
},
"Storage": {
"Provider": "minio",
"DefaultBucket": "goodgo",
"PreSignedUrlExpirationSeconds": 3600,
"MaxFileSizeBytes": 104857600,
"MinIO": {
"Endpoint": "167.114.174.113:9000",
"AccessKey": "minioadmin",
"SecretKey": "Velik@2026",
"UseSSL": false,
"Region": "us-east-1"
},
"AliyunOSS": {
"Endpoint": "",
"AccessKeyId": "",
"AccessKeySecret": "",
"Region": ""
}
},
"Redis": {
"ConnectionString": "localhost:6379"
"Host": "167.114.174.113",
"Port": 6379,
"Password": "Velik@2026",
"Database": 0,
"ConnectTimeout": 5000,
"SyncTimeout": 5000
},
"Jwt": {
"Secret": "your-super-secret-key-min-32-characters",
"Secret": "goodgo-iam-service-secret-key-32chars!",
"Issuer": "goodgo-platform",
"Audience": "goodgo-services",
"AccessTokenExpiryMinutes": 15,