[#501] Problems with getUserToken method

Migrated from Redmine #501 | Author: Lenart Ambroz
Status: New | Priority: High, I’m very impatient | Created: 2020-03-27


Hello,

Can you please provide me some help regarding API → getUserToken Method.

This is my request:
{{
“jsonrpc”: “2.0”,
“id”: “1”,
“method”: “getUserToken”,
“params”: [
“Vareo”,
“admin”,
“Odvod404!”
]
}}

And this is what I get. I tried with JS, with .NET and I don’t know where is a problem. Is it on my side?
{{
“error”: {
“code”: -32000,
“message”: “Unexpected error”,
“data”: null
},
“id”: “1”,
“jsonrpc”: “2.0”
}}

Thank you and best regards,
Lenart Ambroz

Lenart Ambroz wrote:

If I create call to getToken method i get token in response, so there is something strange going on.

Redmine Admin wrote:

Please provide full raw http request with urls and headers

Redmine Admin wrote:

<?php

require_once 'JsonRpcClient.php';

define('YOUR_COMPANY_LOGIN', 'vareo');


try {
        $loginClient = new JsonRpcClient('https://user-api.simplybook.me' . '/login/');
        $token = $loginClient->getUserToken(YOUR_COMPANY_LOGIN, 'admin', 'Odvod404!');
        $client = new JsonRpcClient('https://user-api.simplybook.me' . '/admin/', array(
            'headers' => array(
                'X-Company-Login: ' . YOUR_COMPANY_LOGIN,
                 'X-User-Token: ' . $token
            )
        ));

} catch (Exception $e) {
         echo 'Login fault';
        var_dump($e);
        exit();

}

$res = $client->getEventList();
var_dump($res);

?>

this sample code workin just fine

Lenart Ambroz wrote:

Redmine Admin wrote:

[…]

this sample code workin just fine

Thank you I Figure it out… Case sensitive was a problem.

Thanks