Closed FredericCasazza closed 6 years ago
Hi, the last release had an issue with the authentication so in this case you will need to use the development version until the next release is available.
Okay, I'll try that.
Thank you
ok, it may not be your lib that is the problem, the command curl below works from one of our linux servers (curl 7.29.0) but not from my windows 7 computer (curl 7.47.1) where I test my php dev.
curl -X GET "http://***/apirest.php/initSession/" -H "Content-Type: application/json" -H "Authorization:Basic " -H "App-Token: " -L -k Server linux response => {"session_token":"***"} My computer => ["ERROR_APP_TOKEN_PARAMETERS_MISSING",...]
I installed an instance of GLPI 1.9.4 locally to test and it works.... I don't understand why it doesn't work between my computer and our GLPI server.
Problem solved, the token I was using was not good.... Too bad the message returned by GLPI is not "Bad token" instead of "Token is missing".
Hello, I have a problem when calling the initSession method. I use the example of documentation to initialize a failed session with the following error message "The current API requires an App-Token header for using its methods." I added the call to the setAppToken method by passing a token as a parameter without any more success: $client = new Client('http://********/apirest.php', new \GuzzleHttp\Client()); $client->setAppToken('****'); $client->initSessionByCredentials('**','');
However it work when I initialize a session using the curl php functions: $ch = curl_init(); curl_setopt_array($ch, array( CURLOPT_RETURNTRANSFER => 1, CURLOPT_URL => "http://********/apirest.php/initSession", CURLOPT_HTTPHEADER => array( "Content-Type" => "application/json", Authorization' => "Basic ".base64_encode(':'), "App-Token" =>"***'' ) )); $result = curl_exec($ch); curl_close($ch); print_r($result);
I use GLPI 9.1.4, PHP7+ and Guzzle 6.3. Have you ever heard other people who would have encountered this problem? Do you have a solution?
Thank you