> For the complete documentation index, see [llms.txt](https://developer.ghsv.vn/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.ghsv.vn/api/xac-thuc-moi-truong.md).

# Xác thực / môi trường

## Testing

{% hint style="info" %}
Dữ liệu trong môi trường này sẽ không được lưu trữ lâu dài, phục vụ mục đích thử nghiệm.
{% endhint %}

```
REQUEST / HTTP/1.1
Host: testing-api.ghsv.vn
Content-Type: application/json
Token: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoiMTQiLCJicmFuY2giOiJkZW1vLmdoc3Yudm4iLCJzZXNzaW9uIjoxNjUyNDY0MTU4fQ.zBeoadjqMWsJj26VeWoV9vrtPKOhDNriZaAm_IqpQGM
```

## Production

### Khởi tạo Token

{% hint style="info" %}
Token dùng để xác định tài khoản thực hiện các yêu cầu qua API từ đó đồng bộ với hệ thống GHSV.&#x20;
{% endhint %}

![](/files/OqBKz4CFSfPl6QsPJdx1)

```
REQUEST / HTTP/1.1
Host: api.ghsv.vn
Content-Type: application/json
Token: token-cua-ban
```

## Cấu trúc Response chung

* Token không hợp lệ

```json
// Content-Type: application/json
// 403: Unauthorized
{
    "success": false,
    "msg": "Token không hợp lệ."
}
```

* Thao tác thành công

```json
// Content-Type: application/json
// 200: OK
{
    "success": true,
    "msg": ""
    // thông tin khác
}
```

* Thao tác thất bại

```json
// Content-Type: application/json
// 200: OK
{
    "success": false,
    "msg": "nguyên nhân / lý do."
}
```
