ورود
با ایمیل و گذرواژه احراز هویت کنید تا توکن دسترسی و توکن تازهسازی JWT دریافت کنید.
ورود
POST
/api/v1/auth/loginبا ایمیل و گذرواژه احراز هویت کنید تا توکن دسترسی و توکن تازهسازی JWT دریافت کنید.
احراز هویت:بدون احراز هویت
پارامترهای درخواست
| پارامتر | نوع | الزامی | توضیحات |
|---|---|---|---|
email | string | الزامی | The email address associated with the user account. |
password | string | الزامی | The user's password. |
totp_code | string | اختیاری | 6-digit TOTP code from an authenticator app. Required only when the account has two-factor authentication enabled. |
device_id | string | اختیاری | Unique device identifier (UUID recommended). Used for device tracking and session management. |
platform | string | اختیاری | Client platform. One of: ios, android, windows, macos, linux, web. |
device_name | string | اختیاری | Human-readable device name, e.g. "iPhone 15 Pro" or "Chrome on MacBook". |
fcm_token | string | اختیاری | Firebase Cloud Messaging token for push notifications. |
نمونههای کد
curl -X POST https://api.orbai.world/api/v1/auth/login \
-H "Content-Type: application/json" \
-d '{
"email": "user@example.com",
"password": "your_password",
"totp_code": "482910",
"device_id": "550e8400-e29b-41d4-a716-446655440000",
"platform": "ios",
"device_name": "iPhone 15 Pro",
"fcm_token": "eyJhbGciOiJIUzI1NiIs..."
}'Responses
200احراز هویت موفق بود. پروفایل کاربر، توکنهای JWT و اطلاعات اشتراک بازگردانده میشود.
{
"success": true,
"data": {
"user": {
"id": 1,
"uuid": "usr_abc123",
"username": "john_doe",
"email": "user@example.com",
"role": "USER",
"active": true
},
"tokens": {
"access_token": "eyJhbGciOiJIUzI1NiIs...",
"refresh_token": "dGhpcyBpcyBhIHJlZnJlc2...",
"access_token_expires_at": "2026-02-09T12:00:00Z",
"refresh_token_expires_at": "2026-03-08T12:00:00Z",
"token_type": "Bearer"
},
"subscription": {
"plan_name": "Premium",
"status": "active",
"expires_at": "2026-12-31T23:59:59Z"
},
"requires_2fa": false
}
}401ایمیل یا گذرواژه نادرست است.
{
"success": false,
"error": {
"code": "INVALID_CREDENTIALS",
"message": "The email or password you entered is incorrect."
}
}422خطای اعتبارسنجی. یک یا چند فیلد اعتبارسنجی را رد کردند.
{
"success": false,
"error": {
"code": "VALIDATION_ERROR",
"message": "Validation failed.",
"details": {
"email": "Must be a valid email address.",
"password": "This field is required."
}
}
}429تلاشهای ورود بیش از حد. سقف نرخ اعمال شد.
{
"success": false,
"error": {
"code": "RATE_LIMITED",
"message": "Too many login attempts. Please try again later."
}
}نقاط پایانی مرتبط
- ثبتنام -- ثبتنام
- توکن تازهسازی -- توکن تازهسازی
- ورود با OAuth -- ورود با OAuth
- پیوند جادویی -- پیوند جادویی
- کلیدهای عبور -- کلیدهای عبور
- مدیریت دستگاهها و نشستها -- رفع DEVICE_LIMIT_EXCEEDED و فهرست دستگاههای فعال
- بازنشانی و تغییر گذرواژه -- فراموشی، بازنشانی یا تغییر گذرواژه