From 0f67bf18003e76bb4b24c4e5524ae9c09799c038 Mon Sep 17 00:00:00 2001 From: Marcin Haba Date: Tue, 28 Nov 2017 18:36:47 +0100 Subject: [PATCH] baculum: Fix oauth2 client working in the web part --- gui/baculum/protected/Web/Class/BaculumAPIClient.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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']; -- 2.39.5