Первичная аутентификация
Смысл первичной аутентификации заключается в получении списка customers, связанного с учетной записью пользователя.
Адрес получения токена зависит от среды:
| Среда | URL получения токена |
|---|---|
| Тест | https://api-test.berekebank.kz/auth/oauth/token |
| Промышленная | https://business.berekebank.kz/auth/oauth/token |
| endpoint | /auth/oauth/token |
|---|---|
| Параметры строки запроса / Query String Parameters | grant_type=Password |
| user_type=customer | |
username={encoded username} <-- шифруется с использованием public key | |
password={encoded password} <-- шифруется с использованием public key | |
| system_name=API | |
| Request method | POST |
| Response status | 200 |
примечание
Параметр system_name=API обязателен — он указывает, что запрос выполняется через API-интеграцию. Передаётся одинаково на тестовой и промышленной средах.
Дополнительные заголовки / Additional headers
| Content-Type | application/json |
| Authorization | Basic V0VCOg== |
Ответ / Response object
| № | Поле | Тип данных | Примечание |
|---|---|---|---|
| 1 | access_token | string | JWT |
| 2 | token_type | string | "bearer" |
| 3 | refresh_token | string | JWT |
| 4 | expires_in | long | |
| 5 | scope | string | "ALL" |
| 6 | passed_auth_factors | array | [] |
| 7 | customer_external_id | string | |
| 8 | chain_type | string | |
| 9 | role | string | |
| 10 | created | datetime | "YYYY-MM-DDTHH:mm:ss.ff" |
| 11 | role_version | long | |
| 12 | cus_unique_idn | string | |
| 13 | is_password_change | boolean | false |
| 14 | sign_level | ||
| 15 | roles_auth_factors | array | |
| 16 | auth_factor_chain | array | [] |
| 17 | role | object | |
| 18 | id | ||
| 19 | code | ||
| 20 | user_type | string | "customer" |
| 21 | suggest_add_device | boolean | |
| 22 | user_id | long | |
| 23 | role_id | long | |
| 24 | bank_branch_code | ||
| 25 | decrypted_username | ||
| 26 | can_skip | boolean | true |
| 27 | is_device_trusted | boolean | |
| 28 | otp_strategy | ||
| 29 | possible_chains | array | [] |
| 30 | customer_user_id | long | |
| 31 | customers | array of objects | Описание customer в таблице далее |
| 32 | customer_id | long | |
| 33 | digital_signature_type | string | |
| 34 | Jti | string | uuid |
Полученные данные обрабатываются на фронте и далее инициируется переход на главную страницу.
Customer object
| № | Поле | Тип данных | Примечание |
|---|---|---|---|
| 1 | id | long | Идентификатор для customer в системе |
| 2 | name | string | Название customer в системе |
Пример запроса
Показать запрос
cURL
curl --location \
'https://api-test.berekebank.kz/auth/oauth/token?grant_type=Password&user_type=customer&system_name=API&username=<encoded>&password=<encoded>' \
--header 'Authorization: Basic V0VCOg==' \
--header 'Content-Type: application/json' \
--data-raw '{}'
Пример ответа
Показать ответ
{
"access_token": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJkZW1vX3VzZXIiLCJzY29wZSI6IkFMTCJ9.demo_signature",
"expires_in": 899,
"scope": "ALL",
"passed_auth_factors": [],
"customer_external_id": null,
"chain_type": "EMPTY",
"role": "ANONYMOUS",
"created": "2025-02-17T16:39:46.054",
"role_version": 0,
"cus_unique_idn": "210840000011",
"is_password_change": false,
"sign_level": null,
"roles_auth_factors": [],
"user_type": "customer",
"suggest_add_device": false,
"user_id": 111111111111,
"role_id": 0,
"bank_branch_code": null,
"decrypted_username": "demo_user",
"can_skip": false,
"is_device_trusted": false,
"otp_strategy": "UNDEFINED",
"possible_chains": [],
"customer_user_id": 0,
"customers": [
{
"id": 111111,
"name": "ТОО «Ромашка»"
},
{
"id": 111111,
"name": "Иванов Иван"
},
{
"id": 111111,
"name": "ИП Иванов"
},
{
"id": 111111,
"name": "АО «Демо Трейд»"
},
{
"id": 111111,
"name": "Иванов Иван"
},
{
"id": 111111,
"name": "ИП Иванов"
},
{
"id": 111111,
"name": "ТОО «Ромашка»"
},
{
"id": 111111,
"name": "АО «Демо Трейд»"
},
{
"id": 111111,
"name": "ТОО «Ромашка»"
},
{
"id": 111111,
"name": "ИП Иванов"
},
{
"id": 111111,
"name": "ИП Иванов"
}
],
"customer_id": null,
"digital_signature_type": null,
"jti": "74531e41-0560-49b5-a2f8-def49731d390"
}