Skip to content

Commit

Permalink
improve oauth2_handler get_token conditional
Browse files Browse the repository at this point in the history
  • Loading branch information
Fernando committed Apr 29, 2015
1 parent 64ac767 commit 8874829
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions ads_common/lib/ads_common/auth/oauth2_handler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,10 @@ def auth_string(credentials)
# Overrides base get_token method to account for the token expiration.
def get_token(credentials = nil)
token = super(credentials)
@client.issued_at = Time.parse(@client.issued_at) if !@client.nil? && @client.issued_at.class.name == 'String'
token = refresh_token! if !@client.nil? && @client.expired?
unless @client.nil?
@client.issued_at = Time.parse(@client.issued_at) if @client.issued_at.class.name == 'String'
token = refresh_token! if @client.expired?
end
return token
end

Expand Down

0 comments on commit 8874829

Please sign in to comment.