class OmniAuth::Strategies::Heroku

Constants

AUTH_URL

This style of overriding the default means it can only be done when the class is loaded. Which is problematic for testing, and a bit against the grain of how the base class expects this to work, where consumers would explicitly override by passing in the option.

DEFAULT_API_URL
DEFAULT_IMAGE_URL

Public Instance Methods

request_phase() click to toggle source

override method in OmniAuth::Strategies::OAuth2 to error when we don't have a client_id or secret:

Calls superclass method
# File lib/omniauth/strategies/heroku.rb, line 53
def request_phase
  if missing_client_id?
    fail!(:missing_client_id)
  elsif missing_client_secret?
    fail!(:missing_client_secret)
  else
    super
  end
end

Private Instance Methods

account_info() click to toggle source
# File lib/omniauth/strategies/heroku.rb, line 71
def account_info
  @account_info ||= MultiJson.decode(heroku_api.get("/account").body)
end
api_url() click to toggle source
# File lib/omniauth/strategies/heroku.rb, line 75
def api_url
  @api_url ||= ENV.fetch("HEROKU_API_URL", DEFAULT_API_URL)
end
heroku_api() click to toggle source
# File lib/omniauth/strategies/heroku.rb, line 79
def heroku_api
  @heroku_api ||= Faraday.new(
    url: api_url,
    headers: {
      "Accept" => "application/vnd.heroku+json; version=3",
      "Authorization" => "Bearer #{access_token.token}"
    }
  )
end
missing_client_id?() click to toggle source
# File lib/omniauth/strategies/heroku.rb, line 89
def missing_client_id?
  [nil, ""].include?(options.client_id)
end
missing_client_secret?() click to toggle source
# File lib/omniauth/strategies/heroku.rb, line 93
def missing_client_secret?
  [nil, ""].include?(options.client_secret)
end