Перейти до вмісту

Authenticate an account by login and password

Цей контент ще не доступний вашою мовою.

authAccountFly checks the web login and web password of an account and, when they match, returns everything getAccountInfo returns. The login is looked up across all customers, so you do not need to know which customer owns the account. Use it in a service of the switch operator, such as a chat bot or a self-care app for all your customers, where a user signs in with nothing but a login and a password.

Only the root customer may call it. Calls in trusted mode are accepted without extra parameters.

authAccount authAccountFly
Who may call it Any customer The root customer and trusted hosts
Accounts it finds Accounts of the authenticated customer Accounts of every customer
Sign in by username or email username only
Returns i_account i_account, i_customer and all attributes of the account, with its balance

Use authAccount when your website or app works for one customer, for example a reseller’s portal: it cannot reach other customers’ accounts. Use authAccountFly when one service of yours serves the accounts of all customers and you would otherwise call getAccountInfo and authAccount one after another.

Name Type Required Description
username string yes Web login of the account. Must be unique across all customers
password string yes Web password of the account, or its one-time password (see below)
include_balance boolean no False returns the account without balance and credit_limit, which is faster. Default True
Name Type Description
result string OK
i_account int ID of the account
i_customer int ID of the customer that owns the account
account struct The attributes of the account, as members of the getAccountInfo response, plus time_zone_name, the name of its time zone such as Europe/Kyiv. balance and credit_limit only when include_balance is True

Unlike getAccountInfo, the attributes are inside account, not next to result. Passwords are not returned. Dates come back as strings in UTC.

request
call("authAccountFly", {"username": "1001", "password": "kq7Rm2xVt9Lp"})
response
{
"result": "OK",
"i_account": 3092,
"i_customer": 7,
"account": {
"i_account": 3092,
"i_customer": 7,
"username": "1001",
"blocked": 0,
"i_time_zone": 289,
"time_zone_name": "Europe/Kyiv",
"email": "reception@example.com",
"i_balance": 5120,
"balance": -12.34,
"credit_limit": 0.0,
# … the other getAccountInfo fields
},
}

A login with a one-time password ends with fault 410 and returns no account data. Ask the user for a new password, as with authAccount.

faultCode faultString Cause
400 No account identification specified username is missing or empty
400 No password specified password is missing
401 You do not have permissions to use this API call. The authenticated customer is not the root customer
401 Unauthorized No account with this login, or a wrong password
401 More than one account matched Several customers have an account with this login. Use authAccount as the owning customer instead
410 Authenticated using One Time Password Not an error: the account was authenticated with a one-time password from resetAccountOneTimePassword
500 The balance could not be read. Retry, or call with include_balance set to False