From 258117c712dcf7753015d6d12aa7d4ba992f1f0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dezs=C5=91=20BICZ=C3=93?= Date: Mon, 8 Jan 2024 09:49:20 +0100 Subject: [PATCH] Companion fix for apigee/apigee-client-php/pull/334 (#1019) --- src/Plugin/KeyInput/ApigeeAuthKeyInput.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/Plugin/KeyInput/ApigeeAuthKeyInput.php b/src/Plugin/KeyInput/ApigeeAuthKeyInput.php index ab4dab8d..c2610316 100644 --- a/src/Plugin/KeyInput/ApigeeAuthKeyInput.php +++ b/src/Plugin/KeyInput/ApigeeAuthKeyInput.php @@ -26,6 +26,7 @@ use Drupal\Component\Serialization\Json; use Drupal\Core\Form\FormStateInterface; use Drupal\key\Plugin\KeyInputBase; +use Http\Client\Exception; /** * Apigee Edge authentication credentials input text fields. @@ -133,7 +134,14 @@ public function buildConfigurationForm(array $form, FormStateInterface $form_sta $state_for_not_gcp_hosted = []; $gceServiceAccountAuth = new GceServiceAccountAuthentication(\Drupal::service('apigee_edge.authentication.oauth_token_storage')); - if ($gceServiceAccountAuth->isAvailable()) { + $is_gce_hosted_site = FALSE; + try { + $is_gce_hosted_site = $gceServiceAccountAuth->isAvailable(); + } + catch (Exception) { + + } + if ($is_gce_hosted_site) { $form['gcp_hosted'] = [ '#type' => 'checkbox', '#title' => $this->t('Use the default service account if this portal is hosted on GCP'),