dolibarr 21.0.0-beta
Login Class Reference

API that allows to log in with an user account. More...

Public Member Functions

 __construct ()
 Constructor of the class.
 
 loginUnsecured ($login, $password, $entity='', $reset=0)
 Login.
 
 index ($login, $password, $entity='', $reset=0)
 Login.
 

Detailed Description

API that allows to log in with an user account.

Definition at line 29 of file api_login.class.php.

Member Function Documentation

◆ index()

Login::index ( $login,
$password,
$entity = '',
$reset = 0 )

Login.

Request the API token for a couple username / password. WARNING: You should NEVER use this API, like you should never use the similar API that uses the POST method. This will expose your password. To use the APIs, you should instead set an API token to the user you want to allow to use API (This API token called DOLAPIKEY can be found/set on the user page) and use this token as credential for any API call. From the API explorer, you can enter directly the "DOLAPIKEY" into the field at the top right of the page to get access to any allowed APIs.

Parameters
string$loginUser login
string$passwordUser password
string$entityEntity (when multicompany module is used). '' means 1=first company.
int$resetReset token (0=get current token, 1=ask a new token and canceled old token. This means access using current existing API token of user will fails: new token will be required for new access)
Returns
array Response status and user token
Exceptions
RestException403 Access denied
RestException500 System error

@url POST /

Definition at line 93 of file api_login.class.php.

References $conf, ascii_check(), checkLoginPassEntity(), dol_hash(), dol_syslog(), dolEncrypt(), getDolGlobalString(), and utf8_check().

Referenced by loginUnsecured().

◆ loginUnsecured()

Login::loginUnsecured ( $login,
$password,
$entity = '',
$reset = 0 )

Login.

Request the API token for a couple username / password. WARNING: You should NEVER use this API, like you should never use the similar API that uses the POST method. This will expose your password. To use the APIs, you should instead set an API token to the user you want to allow to use API (This API token called DOLAPIKEY can be found/set on the user page) and use this token as credential for any API call. From the API explorer, you can enter directly the "DOLAPIKEY" into the field at the top right of the page to get access to any allowed APIs.

Parameters
string$loginUser login
string$passwordUser password
string$entityEntity (when multicompany module is used). '' means 1=first company.
int$resetReset token (0=get current token, 1=ask a new token and canceled old token. This means access using current existing API token of user will fails: new token will be required for new access)
Returns
array Response status and user token
Exceptions
RestException403 Access denied
RestException500 System error

@url GET /

Definition at line 69 of file api_login.class.php.

References index().


The documentation for this class was generated from the following file: