1
0
forked from BRT/arc
arc/docs/api/auth.md
trnsmkot 80be0ee7e9 Add Ozon pay_to_new_number and pay_to_old_number XML assets
Included XML files for the "pay to new number" and "pay to old number" features in the Ozon platform.
2026-03-01 09:30:59 +07:00

66 lines
1.3 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Auth API
[← Главная](../index.md)
Авторизация через API-ключ и управление токенами.
Все защищённые эндпоинты требуют заголовок:
```
Authorization: Bearer <access_token>
```
---
## POST `/api/v1/auth/login`
Получение токена по API-ключу.
**Тело запроса:**
```json
{
"api_key": "string"
}
```
**Ответ:**
```json
{
"success": true,
"data": {
"id": "uuid",
"access_token": "string",
"refresh_token": "string",
"expires_in": 3600.0
}
}
```
---
## POST `/api/v1/auth/refresh_token`
Обновление access_token по refresh_token.
**Тело запроса:**
```json
{
"refresh_token": "string"
}
```
**Ответ:** аналогичен `/login`.
---
## Хранение токенов в проекте
Токены сохраняются в `config.ini`:
| Ключ | Значение |
|------|----------|
| `common/access_token` | Bearer-токен для запросов |
| `common/refresh_token` | Для обновления |
| `common/token_expires_at` | Unix timestamp истечения |
Рефреш токена происходит автоматически за 30 минут до истечения — см. `NetworkService::scheduleNextRefresh()`.