Skip to content

Commit 0c5735b

Browse files
committed
update config
1 parent 3eff76c commit 0c5735b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/bandwidth-sdk/configuration.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,8 +194,9 @@ def initialize
194194
@logger = defined?(Rails) ? Rails.logger : Logger.new(STDOUT)
195195
@access_token_expires_at = nil
196196
@access_token_getter = Proc.new {
197-
access_token_valid = @access_token && @access_token_expires_at > Time.now + 60
197+
access_token_valid = @access_token && (@access_token_expires_at.nil? || @access_token_expires_at > Time.now + 60)
198198
next @access_token if access_token_valid
199+
next unless @client_id && @client_secret
199200

200201
puts "Refreshing access token..." if @debugging
201202
# obtain new access token using client credentials
@@ -272,7 +273,6 @@ def api_key_with_prefix(param_name, param_alias = nil)
272273
# Gets access_token using access_token_getter or uses the static access_token
273274
def access_token_with_refresh
274275
return access_token if access_token_getter.nil?
275-
return unless @client_id && @client_secret
276276
access_token_getter.call
277277
end
278278

0 commit comments

Comments
 (0)