services / auth-service
Auth Service
Email/username-based authentication service with JWT tokens. Built with Django REST Framework, deployed on AWS Lambda via Zappa.
authjwtdjangoemail
Auth Service (zv-auth-service)
Email/username-based authentication with JWT tokens, user profiles, addresses, and payment cards. Built with Django REST Framework.
Service Info
| Property | Value |
|---|---|
| Framework | Django + DRF |
| Database | PostgreSQL (dev0) |
Base URLs
| Environment | URL |
|---|---|
| Test (dev) | https://test.zonevast.com/api/v1/auth/auth/ |
| Production | https://api.zonevast.com/api/v1/auth/auth/ |
| Local | http://localhost:8010/api/v1/auth/auth/ |
Authentication Endpoints
Login (JWT Tokens)
curl -X POST https://test.zonevast.com/api/v1/auth/auth/token/ \
-H "Content-Type: application/json" \
-d '{"username": "admin", "password": "admin123"}'
Response:
{
"access": "eyJhbGciOiJIUzI1NiJ9...",
"refresh": "eyJhbGciOiJIUzI1NiJ9..."
}
Refresh Token
curl -X POST https://test.zonevast.com/api/v1/auth/auth/token/refresh/ \
-H "Content-Type: application/json" \
-d '{"refresh": "YOUR_REFRESH_TOKEN"}'
Switch Project Context
curl -X POST https://test.zonevast.com/api/v1/auth/auth/token/change_project/ \
-H "Authorization: Bearer TOKEN" \
-H "Content-Type: application/json" \
-d '{"project_id": <project-id>}'
Logout
curl -X POST https://test.zonevast.com/api/v1/auth/auth/logout/ \
-H "Authorization: Bearer TOKEN"
Registration & Verification
Register
curl -X POST https://test.zonevast.com/api/v1/auth/auth/register/ \
-H "Content-Type: application/json" \
-d '{
"username": "newuser",
"email": "user@example.com",
"password": "secure-password",
"first_name": "John",
"last_name": "Doe"
}'
Verify OTP
curl -X POST https://test.zonevast.com/api/v1/auth/auth/verify-otp/ \
-H "Content-Type: application/json" \
-d '{"email": "user@example.com", "otp": "123456"}'
Resend OTP
curl -X POST https://test.zonevast.com/api/v1/auth/auth/send-otp/ \
-H "Content-Type: application/json" \
-d '{"email": "user@example.com"}'
Password Management
Reset Password
# Initiate reset
curl -X POST https://test.zonevast.com/api/v1/auth/auth/password/reset/ \
-H "Content-Type: application/json" \
-d '{"email": "user@example.com"}'
# Change password (authenticated)
curl -X POST https://test.zonevast.com/api/v1/auth/auth/password/change/ \
-H "Authorization: Bearer TOKEN" \
-H "Content-Type: application/json" \
-d '{"old_password": "old", "new_password": "new"}'
User Management (Authenticated)
Get/Update User
# Get current user
curl https://test.zonevast.com/api/v1/auth/auth/user/ \
-H "Authorization: Bearer TOKEN"
# Update user
curl -X PATCH https://test.zonevast.com/api/v1/auth/auth/user/ \
-H "Authorization: Bearer TOKEN" \
-H "Content-Type: application/json" \
-d '{"first_name": "Updated", "language": "ar"}'
Upload Profile Image
curl -X POST https://test.zonevast.com/api/v1/auth/auth/user/upload-image/ \
-H "Authorization: Bearer TOKEN" \
-F "image=@/path/to/image.jpg"
Change Language
curl -X POST https://test.zonevast.com/api/v1/auth/auth/user/language/ \
-H "Authorization: Bearer TOKEN" \
-H "Content-Type: application/json" \
-d '{"language": "ar"}'
Profile & Data
User Profile
# Create profile
curl -X POST https://test.zonevast.com/api/v1/auth/auth/profile/ \
-H "Authorization: Bearer TOKEN" \
-H "Content-Type: application/json" \
-d '{
"bio": "Developer",
"gender": "M",
"birth_date": "1990-01-01"
}'
# Get profile
curl https://test.zonevast.com/api/v1/auth/auth/profile/ \
-H "Authorization: Bearer TOKEN"
Addresses
curl -X POST https://test.zonevast.com/api/v1/auth/auth/address/ \
-H "Authorization: Bearer TOKEN" \
-H "Content-Type: application/json" \
-d '{
"address_type": "home",
"street_address": "123 Main St",
"city": "Riyadh",
"country": "SA"
}'
Payment Cards
curl https://test.zonevast.com/api/v1/auth/auth/payment-card/ \
-H "Authorization: Bearer TOKEN"
Countries & Regions
# List countries
curl https://test.zonevast.com/api/v1/auth/auth/country/
# Regions by country
curl https://test.zonevast.com/api/v1/auth/auth/region/saudi-arabia/
Dev-Only Endpoints
Create Test Users
curl -X POST https://test.zonevast.com/api/v1/auth/auth/test-users/ \
-H "Content-Type: application/json" \
-d '{"count": 5}'
Only available in dev/test environments.
Deployment
cd /home/yousef/Documents/workspace/zonevast/services/zv-auth-service/
zappa update dev # Deploy to test.zonevast.com
zappa update prod # Deploy to production
zappa tail dev # View logs
Last validated: 2026-04-27