Authentication and login process for customer interface

  1. Get <user name> from your account manager. It is usually customer_interface for the customer interface, but it might be different depending on the project.
  2. Create a token using the method [badge-green POST] /tokens.
    The creation of a token is different from other API calls. HTTP Authorization header contains only a login name and no token (because it doesn't exist yet).
    <user name>:

    Value of HTTP header Authentication contains BASE64 encoded string <user name>:. The request looks like this:

POST <projectURL>/rest-api/customer-interface/v1.0/tokens
Content-Type: application/json
Accept-Language: cs, en-gb;q=0.8
Authorization: Basic Y3VzdG9tZXJfaW50ZXJmYWNlOiA=
  1. You will get a token_id as a response.
    {
    "data":{
    "token_id":<token_id>
    }
    }
  2. The next step is to put together the user name and token in the HTTP Authorization header. The value of the header has to be BASE 64 encoded.
    <user name>:<token_id>

    HTTP Authorization header looks similar to:

    Authorization: Basic Y3VzdG9tZXJfaW50ZXJmYWNlOiA=
  3. For the customer login use the method [badge-green POST] /tokens/{token_id}/actions/login. Remember to set <token_id> in the HTTP Authorization header as is in step nr. 4. Put right customer credentials in the request's body after.

Note: Do not copy the credentials below. Code is just an example of a method used.

{
  "login_type": "email",
  "login_value": "example@crmcarecloud.com",
  "password": "password_example"
}
  1. You will receive the customer_id of the logged-in customer as a response.
    {
    "data":{
    "customer_id":<customer_id>
    }
    }