/v1/auth/token
Cấp Bearer token
Đăng nhập bằng email/mật khẩu tài khoản, nhận token dùng cho các request sau. Không tạo session cookie web.
Tham số
| Tên | Vị trí | Bắt buộc | Mô tả |
|---|---|---|---|
email |
body | Có | Email đăng ký |
password |
body | Có | Mật khẩu |
token_name |
body | Có | Tên gợi nhớ (vd. server-prod) |
Ví dụ curl
curl -X POST http://test.2movn.com/api/v1/auth/token \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{
"email": "[email protected]",
"password": "your-password",
"token_name": "my-integration"
}'
Phản hồi mẫu
{
"success": true,
"token": "1|abcdefghijklmnopqrst…",
"token_type": "Bearer",
"user": {
"id": 42,
"email": "[email protected]",
"name": "Nguyen Van A"
}
}
Lưu token ngay khi nhận — không hiển thị lại. Tài khoản không active → 403.