Skip to content

Commit 4a52ce1

Browse files
committed
woring on problem:
1 parent cfe8cea commit 4a52ce1

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

src/DirectAuthenticate.php

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace Slakbal\Citrix;
44

55
use GuzzleHttp\Client as HttpClient;
6+
use GuzzleHttp\ClientInterface;
67

78
class DirectAuthenticate
89
{
@@ -21,7 +22,7 @@ class DirectAuthenticate
2122

2223
protected $client_id;
2324

24-
protected $http_client;
25+
protected $client;
2526

2627
protected $response;
2728

@@ -33,13 +34,11 @@ public function __construct()
3334
$this->username = config('citrix.direct.username');
3435
$this->password = config('citrix.direct.password');
3536
$this->client_id = config('citrix.direct.client_id');
36-
37-
$this->http_client = new HttpClient([
37+
$this->client = new HttpClient([
3838
'base_uri' => $this->base_uri,
3939
'timeout' => $this->timeout,
4040
'verify' => $this->verify_ssl,
4141
]);
42-
4342
}
4443

4544

@@ -52,6 +51,15 @@ public function authenticate()
5251
'client_id' => $this->client_id,
5352
];
5453

54+
if (version_compare(ClientInterface::VERSION, '6') === 1) {
55+
$options = ['form_params' => $params];
56+
} else {
57+
$options = ['body' => $params];
58+
}
59+
60+
$this->response = $this->client->post('/oauth/access_token', $options);
61+
62+
/*
5563
$this->response = $this->http_client->get('/oauth/access_token', [
5664
'header' => [
5765
'Content-Type' => 'application/x-www-form-urlencoded',
@@ -60,7 +68,7 @@ public function authenticate()
6068
'query' => $params,
6169
'form_params' => $params,
6270
]);
63-
71+
*/
6472
// 'headers' => [
6573
// 'Content-Type' => 'application/x-www-form-urlencoded',
6674
// 'Accept' => 'application/json',
@@ -80,7 +88,6 @@ public function authenticate()
8088

8189
$this->statusCode = $this->response->getStatusCode();
8290

83-
8491
$this->response = $this->response->getBody();
8592

8693
//dd( (string)$this->response );

0 commit comments

Comments
 (0)