From: Marcin Haba Date: Tue, 28 Nov 2017 17:36:47 +0000 (+0100) Subject: baculum: Fix oauth2 client working in the web part X-Git-Tag: Release-9.0.7~20 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=0f67bf18003e76bb4b24c4e5524ae9c09799c038;p=bacula%2Fbacula baculum: Fix oauth2 client working in the web part --- diff --git a/gui/baculum/protected/Web/Class/BaculumAPIClient.php b/gui/baculum/protected/Web/Class/BaculumAPIClient.php index cf37822031..85c2bff98f 100644 --- a/gui/baculum/protected/Web/Class/BaculumAPIClient.php +++ b/gui/baculum/protected/Web/Class/BaculumAPIClient.php @@ -596,8 +596,12 @@ class BaculumAPIClient extends WebModule { curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $data); $result = curl_exec($ch); + $header_size = curl_getinfo($ch, CURLINFO_HEADER_SIZE); curl_close($ch); - $tokens = json_decode($result); + $header = substr($result, 0, $header_size); + $body = substr($result, $header_size); + $tokens = json_decode($body); + $this->parseHeader($header); if (is_object($tokens) && isset($tokens->access_token) && isset($tokens->refresh_token)) { $auth = new OAuth2Record(); $auth->host = $st['host'];