> For the complete documentation index, see [llms.txt](https://developers.vinid.net/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developers.vinid.net/tai-lieu-tich-hop/tich-hop-vinid-sso/token-endpoint.md).

# Token endpoint

## /oauth2/token

<mark style="color:green;">`POST`</mark> `https://oauth-qc.vinid.net/oauth2/token`

API này được sử dụng cho Authorization code (PKCE) để exchange token từ authorization code có được từ Auth endpoint.

#### Headers

| Name         | Type   | Description                       |
| ------------ | ------ | --------------------------------- |
| Content-Type | string | application/x-www-form-urlencoded |

#### Request Body

| Name           | Type   | Description |
| -------------- | ------ | ----------- |
| redirect\_uri  | string |             |
| code           | string |             |
| code\_verifier | string |             |
| client\_id     | string |             |
| grant\_type    | string |             |

{% tabs %}
{% tab title="200 " %}

```
{
  "access_token": "string",
  "expires_in": 0,
  "id_token": 0,
  "refresh_token": "string",
  "scope": 0,
  "token_type": "string"
}
```

{% endtab %}
{% endtabs %}

| Tham số        | Định dạng | Mô tả              | Ví dụ                         |
| -------------- | --------- | ------------------ | ----------------------------- |
| client\_id     | string    |                    | 1mg                           |
| grant\_type    | string    |                    | authorization\_code           |
| code\_verifier | string    |                    |                               |
| code           | string    | Authorization code |                               |
| redirect\_uri  | string    |                    | <http://example.com/callback> |
