Первичная аутентификация
Смысл первичной аутентификации заключается в получении списка customers, связанного с учетной записью пользователя.
| endpoint | /auth/oauth/token |
|---|---|
| Параметры строки запроса / Query String Parameters | grant_type=Password |
| user_type=customer | |
username={encoded username} <-- шифруется с использованием public key | |
password={encoded password} <-- шифруется с использованием public key | |
| Request method | POST |
| Response status | 200 |
Дополнительные заголовки / 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 'https://api-test.berekebank.kz/auth/oauth/token?grant_type=Password&user_type=customer&username=[]&password=[] \ -H 'Accept: */*' \ -H 'Accept-Language: ru-RU,ru;q=0.9,en-US;q=0.8,en;q=0.7' \ -H 'Authorization: Basic V0VCOg==' \ -H 'Cache-Control: no-cache' \ -H 'Connection: keep-alive' \ -H 'Content-Type: application/json' \ -b '_ga=GA1.1.1456558304.1751004759; AMP_MKTG_37a989b454=JTdCJTdE; AMP_37a989b454=... (cookies truncated for brevity) ...' \ -H 'Device-Fingerprint:' \ -H 'Origin: https://api-test.berekebank.kz' \ -H 'Pragma: no-cache' \ -H 'Referer: https://api-test.berekebank.kz/customer/login' \ -H 'Sec-Fetch-Dest: empty' \ -H 'Sec-Fetch-Mode: cors' \ -H 'Sec-Fetch-Site: same-origin' \ -H 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36' \ -H 'sec-ch-ua: "Google Chrome";v="137", "Chromium";v="137", "Not/A)Brand";v="24"' \ -H 'sec-ch-ua-mobile: ?0' \ -H 'sec-ch-ua-platform: "Windows"' \ --data-raw '{}'
Пример ответа
{"access_token":"","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":"111111111111","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":"test","can_skip":false,"is_device_trusted":false,"otp_strategy":"UNDEFINED","possible_chains":[],"customer_user_id":0,"customers":[{"id":111111,"name":"ТОО \test\""},{"id":111111,"name":"Test"},{"id":111111,"name":"ИП Test."},{"id":111111,"name":"АО Test"},{"id":111111,"name":"Test"},{"id":111111,"name":"ИП Test"},{"id":111111,"name":"ТОО Test тест тест тест тест тест тест тест тест "},{"id":111111,"name":"АО Test"},{"id":111111,"name":"ТОО Test"},{"id":111111,"name":"ИП Test"},{"id":111111,"name":"ИП test"}],"customer_id":null,"digital_signature_type":null,"jti":"74531e41-0560-49b5-a2f8-def49731d390"}