4.7.1.2.1. Login

Login can be performed by either GET or POST request.

GET request

For GET request, create the URL {host:port}/app-portal/api/login with the following parameters:

  • u − user login

  • p − user password

  • l − user locale (optional)

For example:

http://localhost:8080/app-portal/api/login?u=admin&p=admin&l=ru
POST request

To perform login using POST, execute request by {host:port}/app-portal/api/login address, passing JSON (Content-Type header has the value application/json) or form (Content-Type header has the value application/x-www-form-urlencoded) in request body.

Example of the JSON format:

{
  "username" : "admin",
  "password" : "admin",
  "locale" : "en"
}

Example of the form:

username: admin
password: admin
locale: en

The service will return userSessionId in response body and status 200 or status 401 if the authentication fails.

To login through REST API, the user must have cuba.restApi.enabled specific permission. Notice that the user will have the permission if there are no roles explicitly revoking it.