Ad Widget

Collapse

Problem with API authentication

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • AlexeyK
    Junior Member
    • Dec 2017
    • 1

    #1

    Problem with API authentication

    Hi All,

    I have a problem with authentication via api.
    When I use the user.login method, authentication does not work every time.
    When authenticating through the web, there is no problem.

    Zabbix Server 3.0.4

    $ cat version
    {

    "jsonrpc": "2.0",
    "method": "apiinfo.version",
    "params": [],
    "id": 1

    $ cat data
    {

    "jsonrpc": "2.0",
    "method": "user.login",
    "params": {

    "user": "zabbixUser",
    "password": "passw0rd"

    },
    "id": 1

    }

    $ curl -k -H "Content-Type: application/json-rpc" --data @version zabbix.loc/api_jsonrpc.php
    {"jsonrpc":"2.0","result":"3.0.4","id":1}

    $ curl -k -H "Content-Type: application/json-rpc" --data @data zabbix.loc/api_jsonrpc.php
    {"jsonrpc":"2.0","result":"cb2bc1da4eb53798cc06822 f654be1fe","id":1}
    $ curl -k -H "Content-Type: application/json-rpc" --data @data zabbix.loc/api_jsonrpc.php
    {"jsonrpc":"2.0","result":"83a840ba160fbe74201ef8f 9e7a90f33","id":1}
    $ curl -k -H "Content-Type: application/json-rpc" --data @data zabbix.loc/api_jsonrpc.php
    {"jsonrpc":"2.0","result":"3138b9e5431abd93da105d0 cec916cbe","id":1}
    $ curl -k -H "Content-Type: application/json-rpc" --data @data zabbix.loc/api_jsonrpc.php
    {"jsonrpc":"2.0","error":{"code":-32602,"message":"Invalid params.","data":"Login name or password is incorrect."},"id":1}
    $ curl -k -H "Content-Type: application/json-rpc" --data @data zabbix.loc/api_jsonrpc.php
    {"jsonrpc":"2.0","error":{"code":-32602,"message":"Invalid params.","data":"Login name or password is incorrect."},"id":1}
    $ curl -k -H "Content-Type: application/json-rpc" --data @data zabbix.loc/api_jsonrpc.php
    {"jsonrpc":"2.0","result":"dc0b9b69b168457d551a7d2 a316dc582","id":1}
    $ curl -k -H "Content-Type: application/json-rpc" --data @data zabbix.loc/api_jsonrpc.php
    {"jsonrpc":"2.0","error":{"code":-32602,"message":"Invalid params.","data":"Login name or password is incorrect."},"id":1}
    $ curl -k -H "Content-Type: application/json-rpc" --data @data zabbix.loc/api_jsonrpc.php
    {"jsonrpc":"2.0","result":"ab2fae78a3f1f758bb0e3a6 6d9a53554","id":1}
    $ curl -k -H "Content-Type: application/json-rpc" --data @data zabbix.loc/api_jsonrpc.php
    {"jsonrpc":"2.0","error":{"code":-32602,"message":"Invalid params.","data":"Login name or password is incorrect."},"id":1}
    $ curl -k -H "Content-Type: application/json-rpc" --data @data zabbix.loc/api_jsonrpc.php
    {"jsonrpc":"2.0","error":{"code":-32602,"message":"Invalid params.","data":"Login name or password is incorrect."},"id":1}
    $ curl -k -H "Content-Type: application/json-rpc" --data @data zabbix.loc/api_jsonrpc.php
    {"jsonrpc":"2.0","result":"f34f455ccb0c3c4fd945724 8d928c06a","id":1}
Working...