Skip to main content
Version: Mới nhất

API Reference

4.1 Yêu cầu access_token từ authorization_code (PKCE)

Dùng cho Mobile App.

Thuộc tínhGiá trị
URL[Domain-Server-SSO]/api/authen/sso/mobile/exchange-access-token
MethodPOST
Content-Typeapplication/json

Headers

HeaderValue
app-key<CLIENT_ID>
user-agentMyCustomApp/1.0
Content-Typeapplication/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ệuBắt buộcMô tả
authorization_codestringĐược cung cấp ở cổng SSO sau khi đăng nhập thành công
code_verifierstringBí 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ínhGiá trị
URL[Domain-Server-SSO]/api/authen/sso/web/exchange-access-token
MethodPOST
Content-Typeapplication/json

Headers

HeaderValue
app-key<CLIENT_ID>
user-agentMyCustomApp/1.0
Content-Typeapplication/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ệuBắt buộcMô tả
authorization_codestringĐược cung cấp ở cổng SSO sau khi đăng nhập thành công
client_idstringClient ID
client_secretstringMã 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
}
}
}