public function getOriginalToken()

in modules/quanthub_core/src/WsoToken.php [80:103]


  public function getOriginalToken() {
    try {
      if ((int) getenv('IS_LOCAL_ENV')) {
        // On local env we need to use api with client id, secret etc.
        $response = $this->httpClient->post($this->route, [
          'form_params' => [
            'client_id' => getenv('WSO_TOKEN_CLIENT_ID'),
            'client_secret' => getenv('WSO_TOKEN_CLIENT_SECRET'),
            'grant_type' => getenv('WSO_TOKEN_GRANT_TYPE'),
            'scope' => getenv('WSO_TOKEN_SCOPE'),
          ],
        ]);
      }
      else {
        // In a cluster we are just using request to MSI.
        $response = $this->httpClient->get($this->route, ['headers' => ['Metadata' => 'true']]);
      }
      $response_data = json_decode($response->getBody() ?? '');
      return $response_data->access_token;
    }
    catch (ConnectException $e) {
      $this->logger->notice('Problem with getting WSO Token list');
    }
  }