Login
POST /openapi/v1/auth/login
Xác thực danh tính hệ thống đối tác. Nhận bộ JWT (Access Token + Refresh Token).
Payload trước khi mã hóa:
{
"username": "demo@yourdomain.vn",
"password": "Password#123",
"client_id": "fMLgZltRRtetnsOHXgxsHQ",
"client_secret": "hUFhGJIqz746zcxsYVtrwhkveDuEfcYd"
}
| Field | Required | Description |
|---|---|---|
username | ✅ | Email đăng nhập |
password | ✅ | Mật khẩu |
client_id | ✅ | ID ứng dụng (TCONNECT cung cấp) |
client_secret | ✅ | Bí mật ứng dụng (TCONNECT cung cấp) |
- cURL
- Python
- Go
- JavaScript
curl --location '<base_url>/openapi/v1/auth/login' \
--header 'Partner-Code: YOUR_PARTNER_CODE' \
--header 'Content-Type: application/json' \
--data '{
"data": ENCRYPTED_PAYLOAD
}'
import requests
url = "<base_url>/openapi/v1/auth/login"
payload = {"data": "ENCRYPTED_PAYLOAD"}
headers = {
"Partner-Code": "YOUR_PARTNER_CODE",
"Content-Type": "application/json",
}
response = requests.post(url, headers=headers, json=payload)
print(response.text)
package main
import (
"fmt"
"io"
"net/http"
"strings"
)
func main() {
url := "<base_url>/openapi/v1/auth/login"
body := strings.NewReader(`{"data":"ENCRYPTED_PAYLOAD"}`)
req, _ := http.NewRequest("POST", url, body)
req.Header.Set("Partner-Code", "YOUR_PARTNER_CODE")
req.Header.Set("Content-Type", "application/json")
resp, _ := http.DefaultClient.Do(req)
defer resp.Body.Close()
result, _ := io.ReadAll(resp.Body)
fmt.Println(string(result))
}
const response = await fetch("<base_url>/openapi/v1/auth/login", {
method: "POST",
headers: {
"Partner-Code": "YOUR_PARTNER_CODE",
"Content-Type": "application/json",
},
body: JSON.stringify({ data: "ENCRYPTED_PAYLOAD" }),
});
const result = await response.text();
console.log(result);
Request
Headers
| Name | Required | Description |
|---|---|---|
Partner-Code | ✅ | Mã định danh Merchant (TCONNECT cung cấp) |
Content-Type | ✅ | application/json |
Body
| Field | Type | Required | Description |
|---|---|---|---|
data | string | ✅ | Payload đã mã hóa AES-256-CBC dạng Hexadecimal |
Response
200 — Đăng nhập thành công
| Field | Type | Description |
|---|---|---|
access_token | string | JWT dùng để xác thực request. Đặt vào header Authorization: Bearer <token> |
expires_in | integer | Thời hạn access_token tính bằng giây |
refresh_token | string | Token dài hạn để lấy access_token mới khi hết hạn |
refresh_expires_in | integer | Thời hạn refresh_token tính bằng giây |
token_type | string | Luôn là "Bearer" |
session_state | string | UUID của phiên làm việc trên máy chủ xác thực |
scope | string | Danh sách quyền được cấp |