Class: OmniAuth::Strategies::Instagram

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

Constant Summary collapse

DEFAULT_SCOPE =
"instagram_business_basic"
DEFAULT_FIELDS =
"user_id,username,name,account_type,profile_picture_url,followers_count,follows_count,media_count"

Instance Method Summary collapse

Instance Method Details

#callback_urlObject



46
47
48
# File 'lib/omniauth/strategies/instagram.rb', line 46

def callback_url
  full_host + callback_path
end

#long_lived_tokenObject



54
55
56
# File 'lib/omniauth/strategies/instagram.rb', line 54

def long_lived_token
  @long_lived_token ||= ::OAuth2::AccessToken.from_hash(client, access_token.get("/access_token", params: {grant_type: "ig_exchange_token", client_secret: options.client_secret, access_token: access_token.token}).parsed)
end

#raw_infoObject



50
51
52
# File 'lib/omniauth/strategies/instagram.rb', line 50

def raw_info
  @raw_info ||= long_lived_token.get("/me", params: {fields: DEFAULT_FIELDS}).parsed
end

#token_paramsObject



39
40
41
42
43
44
# File 'lib/omniauth/strategies/instagram.rb', line 39

def token_params
  super.tap do |params|
    params[:client_id] = options.client_id
    params[:client_secret] = options.client_secret
  end
end