diff --git a/lib/googleauth/credentials.rb b/lib/googleauth/credentials.rb index 4db5954..520371d 100644 --- a/lib/googleauth/credentials.rb +++ b/lib/googleauth/credentials.rb @@ -257,6 +257,9 @@ module Google CredentialsLoader.warn_if_cloud_sdk_credentials @client.client_id @project_id ||= CredentialsLoader.load_gcloud_project_id @client.fetch_access_token! + @env_vars = nil + @paths = nil + @scope = nil end # rubocop:enable Metrics/AbcSize diff --git a/lib/googleauth/signet.rb b/lib/googleauth/signet.rb index 4313247..db0dfa8 100644 --- a/lib/googleauth/signet.rb +++ b/lib/googleauth/signet.rb @@ -66,7 +66,7 @@ module Signet end def on_refresh &block - @refresh_listeners ||= [] + @refresh_listeners = [] unless defined? @refresh_listeners @refresh_listeners << block end @@ -84,7 +84,7 @@ module Signet end def notify_refresh_listeners - listeners = @refresh_listeners || [] + listeners = defined?(@refresh_listeners) ? @refresh_listeners : [] listeners.each do |block| block.call self end