API Reference
4.1 Yêu cầu access_token từ authorization_code (PKCE)
Dùng cho Mobile App.
| Thuộc tính | Giá trị |
|---|---|
| URL | [Domain-Server-SSO]/api/authen/sso/mobile/exchange-access-token |
| Method | POST |
| Content-Type | application/json |
Headers
| Header | Value |
|---|---|
app-key | <CLIENT_ID> |
user-agent | MyCustomApp/1.0 |
Content-Type | application/json |
Lấy Client ID
Xem phần Thông tin kỹ thuật để biết cách lấy Client ID
Request Body
{
"authorization_code": "59d45d8e7f7b68ea23dfe0.....",
"code_verifier": "code_verifier_string"
}
| Tên tham số | Kiểu dữ liệu | Bắt buộc | Mô tả |
|---|---|---|---|
authorization_code | string | ✅ | Được cung cấp ở cổng SSO sau khi đăng nhập thành công |
code_verifier | string | ✅ | Bí mật, chỉ lưu ở server TH3; Dùng để quy đổi xác thực code_challenge |
Response Success
{
"version": "1.0.0",
"data": {
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"contact_id": "1",
"username": "2280600348",
"data": {
"ho_ten": "Nguyễn Văn A",
"email": "2280600348@hutech.edu.vn",
"avatar": "",
"so_dien_thoai": "+84976535298"
}
}
}
Response Error
{
"statusCode": 403,
"timestamp": "2025-10-02T08:16:02.876Z",
"path": "/api/authen/sso/mobile/exchange-access-token",
"errorMessage": "HTTP Exception: 403 - [26] Authorization code đã hết hạn",
"reasons": {
"message": "[26] Authorization code đã hết hạn",
"options": {
"code": -1
}
}
}
4.2 Yêu cầu access_token từ authorization_code (SECRET_KEY)
Dùng cho Web App.
| Thuộc tính | Giá trị |
|---|---|
| URL | [Domain-Server-SSO]/api/authen/sso/web/exchange-access-token |
| Method | POST |
| Content-Type | application/json |
Headers
| Header | Value |
|---|---|
app-key | <CLIENT_ID> |
user-agent | MyCustomApp/1.0 |
Content-Type | application/json |
Lấy Client ID
Xem phần Thông tin kỹ thuật để biết cách lấy Client ID
Request Body
{
"authorization_code": "59d45d8e7f7b68ea23dfe0.....",
"client_id": "client_id",
"client_secret": "client_secret_string"
}
| Tên tham số | Kiểu dữ liệu | Bắt buộc | Mô tả |
|---|---|---|---|
authorization_code | string | ✅ | Được cung cấp ở cổng SSO sau khi đăng nhập thành công |
client_id | string | ✅ | Client ID |
client_secret | string | ✅ | Mã bí mật được cung cấp bởi HUTECH TEAM |
Response Success
{
"version": "1.0.0",
"data": {
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"contact_id": "1",
"username": "2280600348",
"data": {
"ho_ten": "Nguyễn Văn A",
"email": "2280600348@hutech.edu.vn",
"avatar": "",
"so_dien_thoai": "+84976535298"
}
}
}
Response Error
{
"statusCode": 403,
"timestamp": "2025-10-02T08:16:02.876Z",
"path": "/api/authen/sso/mobile/exchange-access-token",
"errorMessage": "HTTP Exception: 403 - [34] Authorization code đã hết hạn",
"reasons": {
"message": "[34] Authorization code đã hết hạn",
"options": {
"code": -1
}
}
}