user.checkAuthentication

Description

object user.checkAuthentication

This method checks and prolongs user session.

Calling the user.checkAuthentication method with the parameter sessionid set prolongs user session by default.

Parameters

The method accepts the following parameters.

ParameterTypeDescription
extendbooleanWhether to prolong the user session.

Default value: “true”.
Setting the value to “false” allows to check the user session without prolonging it.

Parameter behavior:
- supported if sessionid is set
sessionidstringUser session ID.

Parameter behavior:
- required if token is not set
secretstringRandom 32 characters string. Is generated on user login.
tokenstringUser API token.

Parameter behavior:
- required if sessionid is not set

Return values

(object) Returns an object containing information about user.

Examples

Request:

  1. {
  2. "jsonrpc": "2.0",
  3. "method": "user.checkAuthentication",
  4. "params": {
  5. "sessionid": "673b8ba11562a35da902c66cf5c23fa2"
  6. },
  7. "id": 1
  8. }

Response:

  1. {
  2. "jsonrpc": "2.0",
  3. "result": {
  4. "userid": "1",
  5. "username": "Admin",
  6. "name": "Zabbix",
  7. "surname": "Administrator",
  8. "url": "",
  9. "autologin": "1",
  10. "autologout": "0",
  11. "lang": "ru_RU",
  12. "refresh": "0",
  13. "theme": "default",
  14. "attempt_failed": "0",
  15. "attempt_ip": "127.0.0.1",
  16. "attempt_clock": "1355919038",
  17. "rows_per_page": "50",
  18. "timezone": "Europe/Riga",
  19. "roleid": "3",
  20. "type": 3,
  21. "userdirectoryid": "0",
  22. "ts_provisioned": "0",
  23. "sessionid": "673b8ba11562a35da902c66cf5c23fa2",
  24. "debug_mode": 0,
  25. "secret": "0e329b933e46984e49a5c1051ecd0751",
  26. "userip": "127.0.0.1",
  27. "gui_access": 0,
  28. "deprovisioned": false,
  29. "auth_type": 0
  30. },
  31. "id": 1
  32. }

Response is similar to User.login call response with “userData” parameter set to true (the difference is that user data is retrieved by session id and not by username / password).

Source

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