Skip to content

Commit

Permalink
Fix "Missing token endpoint URI" Error (#104)
Browse files Browse the repository at this point in the history
  • Loading branch information
kyoshidajp authored and TheRoyalTnetennba committed Aug 16, 2018
1 parent 5bde136 commit 097e24f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/signet/oauth_2/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -804,7 +804,7 @@ def expired?
# @return [TrueClass, FalseClass]
# The expiration state of the access token.
def expires_within?(sec)
return self.expires_at.nil? || Time.now >= (self.expires_at - sec)
return self.expires_at != nil && Time.now >= (self.expires_at - sec)
end

##
Expand Down
4 changes: 2 additions & 2 deletions spec/signet/oauth_2/client_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -442,9 +442,9 @@ def build_form_encoded_response(payload)
expect(@client).to_not be_expired
end

it 'should indicate the token is expired if expired_at nil' do
it 'should indicate the token is not expired if expired_at nil' do
@client.expires_at = nil
expect(@client.expires_within?(60)).to be true
expect(@client.expires_within?(60)).to be false
end

it 'should indicate the token is not expiring when expiry beyond window' do
Expand Down

0 comments on commit 097e24f

Please sign in to comment.