public function getJsonWebTokensforRefresh()

in modules/quanthub_core/src/Plugin/OpenidConnectRealm/QuantHubOpenidConnectRealm.php [236:265]


  public function getJsonWebTokensforRefresh(Token $refresh_token) {
    $guzzle_client = new Client();

    try {
      $response = $guzzle_client->post($this->configuration[self::REFRESH_TOKEN_ENDPOINT], [
        'headers' => [
          'Content-Type' => 'application/json',
        ],
        'json' => [
          'scopes' => $this->configuration['scopes'],
          'authString' => $refresh_token->getValue(),
        ],
      ]);

      // The User Info Data array that should contain token, expiresOn, tokenID.
      $user_info_data = json_decode($response->getBody(), TRUE);
    }
    catch (\Exception $e) {
      $this->logger->error('Failed to retrieve tokens for login from %endpoint: @error.', [
        '%endpoint' => $this->configuration[self::REFRESH_TOKEN_ENDPOINT],
        '@error' => $e->getMessage(),
      ]);

      throw new \RuntimeException('Failed to refresh the user info', 0, $e);
    }

    $tokens = $this->getJsonWebTokensUserInfo($user_info_data, FALSE);

    return $tokens;
  }