module Google::Auth::ExternalAccount::BaseCredentials

def fetch_access_token! _options = {}

def fetch_access_token! _options = {}
  # This method is needed for BaseClient
  response = exchange_token
  if @service_account_impersonation_url
    impersonated_response = get_impersonated_access_token response["access_token"]
    self.expires_at = impersonated_response["expireTime"]
    self.access_token = impersonated_response["accessToken"]
  else
    # Extract the expiration time in seconds from the response and calculate the actual expiration time
    # and then save that to the expiry variable.
    self.expires_at = Time.now.utc + response["expires_in"].to_i
    self.access_token = response["access_token"]
  end
  notify_refresh_listeners
end