Class: HTTP::Auth0::Token

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/http/auth0/token.rb

Instance Method Summary collapse

Instance Method Details

#token(aud:) ⇒ Object



16
17
18
19
20
21
22
23
24
# File 'lib/http/auth0/token.rb', line 16

def token(aud:)
  validate_configuration(key: :client_id)
  validate_configuration(key: :client_secret)

  if (cached = access_tokens[aud])
    return cached unless expired?(token: cached)
  end
  request_access_token(aud: aud)
end