ABRA Flexi allows you to use contacts stored in the database for authentication — typically when you want to give customers from your address book a login to your own application or e-shop, without creating user accounts for them in Flexi. Using the REST API, you first set a username and password for the contact, and then you can authenticate it.
Setting the username and password
The username and password are set for a contact using a standard import into the kontakt record set. The password can be sent in two ways.
Plain-text password
The simplest option — the hash and salt attributes stay empty:
PUT https://demo.flexibee.eu/c/demo/kontakt.xml
<?xml version="1.0"?>
<winstrom version="1.0">
<kontakt>
<id>1</id>
<username>jan</username>
<password hash="" salt="">heslo</password>
</kontakt>
</winstrom>
ABRA Flexi stores a password sent in plain text in a secure form using a hash function. When a contact is read, the password property is always empty — the stored hash is never returned through the API.
Password as the result of a hash function
You can also send the password already hashed. In this case, the hash and salt attributes are required:
PUT https://demo.flexibee.eu/c/demo/kontakt.xml
<?xml version="1.0"?>
<winstrom version="1.0">
<kontakt>
<id>1</id>
<username>jan</username>
<password hash="sha256" salt="abcd">24b7f0b1ec27ba0dd0d0a4a2e1a3b5a7c9d1e3f5a7b9c1d3e5f7a9b1c3d5e7f9</password>
</kontakt>
</winstrom>
The value of the password element is the result of a hash function applied to the string created by joining the value of salt, a colon, and the password — that is, salt + ":" + heslo. The result is written as a lowercase hexadecimal string. In this case, you do not need to send the original password.
💡 The order and the colon matter. For the password tajne and a salt equal to abcd, the string that gets hashed is abcd:tajne — not tajneabcd or abcdtajne.
Supported hash function types:
Value of the | Note |
| The default function for storing passwords sent in plain text. |
| — |
| — |
| — |
| The most secure, but also by far the slowest method — it is deliberately slow. |
⚠️ Any other value of the hash attribute results in a 400 error with the code hashInvalid and the message Unsupported value of the hash attribute.
Authenticating a contact
A contact is authenticated with a POST request to the authenticate action. The username and password are sent as form data:
POST https://demo.flexibee.eu/c/demo/kontakt/1/authenticate
Accept: application/xml
Content-Type: application/x-www-form-urlencoded
username=jan&password=heslo
Authentication also works on the general contacts URL, that is, without specifying a particular record:
POST https://demo.flexibee.eu/c/demo/kontakt/authenticate
Accept: application/xml
Content-Type: application/x-www-form-urlencoded
username=jan&password=heslo
The password is always sent to the authenticate action in plain text — even if you set it in already-hashed form. ABRA Flexi calculates the hash itself.
Result
🚨 The result is always a response with the HTTP status 200 — even when authentication fails. Never judge success by the status code; rely solely on the success property in the response body.
Successful authentication:
<?xml version="1.0"?>
<winstrom version="1.0">
<success>true</success>
<message/>
</winstrom>
Failed authentication:
<?xml version="1.0"?>
<winstrom version="1.0">
<success>false</success>
<message>Bylo zadáno chybné uživatelské jméno či heslo.</message>
</winstrom>
