]> git.sur5r.net Git - bacula/bacula/commitdiff
baculum: Fix oauth2 client working in the web part
authorMarcin Haba <marcin.haba@bacula.pl>
Tue, 28 Nov 2017 17:36:47 +0000 (18:36 +0100)
committerKern Sibbald <kern@sibbald.com>
Sat, 9 Dec 2017 14:06:33 +0000 (15:06 +0100)
gui/baculum/protected/Web/Class/BaculumAPIClient.php

index cf37822031accc3bbf011a4c09c5232bc8fdb193..85c2bff98f66408ae6edc5850d76af8cf8d34c73 100644 (file)
@@ -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'];