class OmniAuth::Strategies::InstagramGraph

Constants

DEFAULT_SCOPE
USER_INFO_URL

Public Instance Methods

authorize_params() click to toggle source

You can pass scope param to the auth request, if you need to set them dynamically. You can also set these options in the OmniAuth config :authorize_params option.

Calls superclass method
# File lib/omniauth/strategies/instagram-graph.rb, line 62
def authorize_params
  super.tap do |params|
    %w[scope].each do |v|
      if request.params[v]
        params[v.to_sym] = request.params[v]
      end
    end

    params[:scope] ||= DEFAULT_SCOPE
  end
end
callback_url() click to toggle source
# File lib/omniauth/strategies/instagram-graph.rb, line 56
def callback_url
  options[:callback_url] || (full_host + script_name + callback_path)
end
info_options() click to toggle source
# File lib/omniauth/strategies/instagram-graph.rb, line 49
def info_options
  params = {}
  params[:fields] = (options[:info_fields] || 'account_type,id,media_count,username')

  {params: params}
end
raw_info() click to toggle source
# File lib/omniauth/strategies/instagram-graph.rb, line 45
def raw_info
  @raw_info ||= access_token.get(USER_INFO_URL, info_options).parsed || {}
end

Protected Instance Methods

build_access_token() click to toggle source
Calls superclass method
# File lib/omniauth/strategies/instagram-graph.rb, line 76
def build_access_token
  access_token = super

  if options.exchange_access_token_to_long_lived
    access_token = long_lived_client.get_token(access_token: access_token.token)
  end

  access_token
end

Private Instance Methods

long_lived_client() click to toggle source
# File lib/omniauth/strategies/instagram-graph.rb, line 88
def long_lived_client
  OmniAuth::InstagramGraph::LongLivedClient.new(client.id, client.secret)
end
prune!(hash) click to toggle source
# File lib/omniauth/strategies/instagram-graph.rb, line 92
def prune!(hash)
  hash.delete_if do |_, value|
    prune!(value) if value.is_a?(Hash)
    value.nil? || (value.respond_to?(:empty?) && value.empty?)
  end
end