[comment]: # ({43f8bc43-43f8bc43})
# user.checkAuthentication

[comment]: # ({/43f8bc43-43f8bc43})

[comment]: # ({3c28b1f2-a9b9d697})
### Description

`object user.checkAuthentication`

This method checks and prolongs the user session.

::: noteimportant
Calling the `user.checkAuthentication` method using the parameter `sessionid` prolongs the user session by default.
:::

[comment]: # ({/3c28b1f2-a9b9d697})

[comment]: # ({22aef924-49a0b391})
### Parameters

The method accepts the following parameters.

|Parameter|[Type](/manual/api/reference_commentary#data-types)|Description|
|--|--|------|
|extend|boolean|Whether to prolong the user session.<br><br>Default value: "true".<br>Setting the value to "false" allows to check the user session without prolonging it.<br><br>[Parameter behavior](/manual/api/reference_commentary#parameter-behavior):<br>- *supported* if `sessionid` is set|
|sessionid|string|User [authentication token](/manual/api#authentication).<br><br>[Parameter behavior](/manual/api/reference_commentary#parameter-behavior):<br>- *required* if `token` is not set|
|token|string|User [API token](/manual/api#authentication).<br><br>[Parameter behavior](/manual/api/reference_commentary#parameter-behavior):<br>- *required* if `sessionid` is not set|

[comment]: # ({/22aef924-49a0b391})

[comment]: # ({b0d25373-a8544e3e})
### Return values

`(object)` Returns an object containing information about the user.

Additionally to the [standard user properties](object#user), the following information is returned.

|Property|[Type](/manual/api/reference_commentary#data-types)|Description|
|--|--|------|
|auth\_type|integer|Default authentication for the user.<br><br>Refer to the `authentication_type` property of the [Authentication object](/manual/api/reference/authentication/object#authentication-object) for a list of possible values.|
|debug\_mode|integer|Whether debug mode is enabled or disabled for the user.<br><br>Refer to the `debug_mode` property of the [User group object](/manual/api/reference/usergroup/object#user-group) for a list of possible values.|
|deprovisioned|boolean|Whether the user belongs to a [deprovisioned users group](/manual/web_interface/frontend_sections/users/authentication#configuration).|
|gui\_access|string|User's authentication method to the frontend.<br><br>Refer to the `gui_access` property of the [User group object](/manual/api/reference/usergroup/object#user-group) for a list of possible values.|
|secret|string|Random 32 characters string. Is generated on user login.<br><br>Property `secret` is not returned if the user session is checked using an API token.|
|sessionid|string|Authentication token, which must be used in the following API requests.<br><br>Property `sessionid` is not returned if the user session is checked using an API token.|
|type|integer|User type.<br><br>Refer to the `type` property of the [Role object](/manual/api/reference/role/object#role) for a list of possible values.|
|userip|string|IP address of the user.|

[comment]: # ({/b0d25373-a8544e3e})

[comment]: # ({b41637d2-e79e2236})
### Examples

[comment]: # ({/b41637d2-e79e2236})

[comment]: # ({ed94544a-d574e685})
##### Check authentication using authentication token

Check and prolong a user session using the user authentication token, and return additional information about the user.

[Request](/manual/api#performing-requests):

```json
{
    "jsonrpc": "2.0",
    "method": "user.checkAuthentication",
    "params": {
        "sessionid": "673b8ba11562a35da902c66cf5c23fa2"
    },
    "id": 1
}
```

Response:

```json
{
    "jsonrpc": "2.0",
    "result": {
        "userid": "1",
        "username": "Admin",
        "name": "Zabbix",
        "surname": "Administrator",
        "url": "",
        "autologin": "1",
        "autologout": "0",
        "lang": "ru_RU",
        "refresh": "0",
        "theme": "default",
        "attempt_failed": "0",
        "attempt_ip": "127.0.0.1",
        "attempt_clock": "1355919038",
        "rows_per_page": "50",
        "timezone": "Europe/Riga",
        "roleid": "3",
        "userdirectoryid": "0",
        "ts_provisioned": "0",
        "type": 3,
        "userip": "127.0.0.1",
        "debug_mode": 0,
        "gui_access": "0",
        "deprovisioned": false,
        "auth_type": 0,
        "sessionid": "673b8ba11562a35da902c66cf5c23fa2",
        "secret": "0e329b933e46984e49a5c1051ecd0751"
    },
    "id": 1
}
```

[comment]: # ({/ed94544a-d574e685})

[comment]: # ({45eaa4f3-698590d0})
##### Check authentication using API token

Check a user session using the user API token, and return additional information about the user.

[Request](/manual/api#performing-requests):

```json
{
    "jsonrpc": "2.0",
    "method": "user.checkAuthentication",
    "params": {
        "token": "00aff470e07c12d707e50d98cfe39edef9e6ec349c14728dbdfbc8ddc5ea3eae"
    },
    "id": 1
}
```

Response:

```json
{
    "jsonrpc": "2.0",
    "result": {
        "userid": "1",
        "username": "Admin",
        "name": "Zabbix",
        "surname": "Administrator",
        "url": "",
        "autologin": "1",
        "autologout": "0",
        "lang": "ru_RU",
        "refresh": "0",
        "theme": "default",
        "attempt_failed": "0",
        "attempt_ip": "127.0.0.1",
        "attempt_clock": "1355919338",
        "rows_per_page": "50",
        "timezone": "Europe/Riga",
        "roleid": "3",
        "userdirectoryid": "0",
        "ts_provisioned": "0",
        "debug_mode": 0,
        "deprovisioned": false,
        "gui_access": "1",
        "mfaid": 0,
        "auth_type": 0,
        "type": 3,
        "userip": "127.0.0.1"
    },
    "id": 1
}
```

[comment]: # ({/45eaa4f3-698590d0})

[comment]: # ({e7148ebe-97f5ed87})
### Source

CUser::checkAuthentication() in *ui/include/classes/api/services/CUser.php*.

[comment]: # ({/e7148ebe-97f5ed87})
