Skip to content

Commit dc801e3

Browse files
committed
Use fresh client for keycloak
1 parent e5b358e commit dc801e3

1 file changed

Lines changed: 3 additions & 6 deletions

File tree

ProcessMaker/Services/ScriptMicroserviceService.php

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,21 +24,18 @@ class ScriptMicroserviceService
2424

2525
private $tenantChecked = false;
2626

27-
private function client($includeToken = true)
27+
private function client()
2828
{
2929
if (!$this->client) {
3030
$this->client = Http::withOptions([
3131
'verify' => !App::environment('local'),
3232
])->baseUrl(config('script-runner-microservice.base_url'))
33+
->withToken($this->getAccessToken())
3334
->accept('application/json')
3435
->contentType('application/json')
3536
->throw();
3637
}
3738

38-
if ($includeToken) {
39-
$this->client->withToken($this->getAccessToken());
40-
}
41-
4239
return $this->client;
4340
}
4441

@@ -151,7 +148,7 @@ public function getAccessToken()
151148
return Cache::get('keycloak.access_token');
152149
}
153150

154-
$response = $this->client(false)->asForm()->post(config('script-runner-microservice.keycloak.base_url') ?? '', [
151+
$response = Http::asForm()->post(config('script-runner-microservice.keycloak.base_url') ?? '', [
155152
'grant_type' => 'password',
156153
'client_id' => config('script-runner-microservice.keycloak.client_id'),
157154
'client_secret' => config('script-runner-microservice.keycloak.client_secret'),

0 commit comments

Comments
 (0)