Class: OmniAuth::Strategies::InstagramGraph

Inherits:
OAuth2
  • Object
show all
Defined in:
lib/omniauth/strategies/instagram-graph.rb

Defined Under Namespace

Classes: NoAuthorizationCodeError

Constant Summary collapse

DEFAULT_SCOPE =
'user_profile,user_media'
USER_INFO_URL =
'https://graph.instagram.com/me'

Instance Method Summary collapse

Instance Method Details

#authorize_paramsObject

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.



62
63
64
65
66
67
68
69
70
71
72
# 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_urlObject



56
57
58
# File 'lib/omniauth/strategies/instagram-graph.rb', line 56

def callback_url
  options[:callback_url] || (full_host + script_name + callback_path)
end

#info_optionsObject



49
50
51
52
53
54
# 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_infoObject



45
46
47
# File 'lib/omniauth/strategies/instagram-graph.rb', line 45

def raw_info
  @raw_info ||= access_token.get(USER_INFO_URL, info_options).parsed || {}
end