# ovok_sdk.auth.token_endpoint

Canonical page: https://docs.ovok.com/python-sdk/reference/auth/token_endpoint

The OAuth token endpoint.

## TokenResponse [#tokenresponse]

```python
TokenResponse(access_token: str, expires_in: float, refresh_token: str | None = None)
```

A successful token endpoint response.

**Attributes**

| Name | Type | Description |
| --- | --- | --- |
| `access_token` | `str` | The new bearer token; never shown in `repr`. |
| `expires_in` | `float` | Lifetime of the access token in seconds. |
| `refresh_token` | `str \| None` | A new refresh token, when the endpoint issues one. |

### from_json() [#from_json]

```python
from_json(body: Mapping[str, Any]) -> TokenResponse
```

Read the snake_case OAuth response body.

## TokenEndpoint [#tokenendpoint]

```python
TokenEndpoint(settings: OvokSettings)
```

Ovok's OAuth token endpoint: one plain form POST, without retries or credentials.

**Parameters**

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| `settings` | `OvokSettings` |  | The client's settings. |

### request() [#request]

```python
request(form: Mapping[str, str]) -> TokenResponse
```

Post `form` to the token endpoint.

**Parameters**

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| `form` | `Mapping[str, str]` |  | OAuth form fields, such as `grant_type`. |

**Returns**

- `TokenResponse`: The issued tokens.

**Raises**

- `OvokError`: The endpoint answered with an error.
