Class: OmniAuth::Strategies::Snapchat

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

Instance Method Summary collapse

Instance Method Details

#authorize_paramsObject



16
17
18
19
20
# File 'lib/omniauth/strategies/snapchat.rb', line 16

def authorize_params
  super.tap do |params|
    params[:scope] = options[:scope] if options[:scope]
  end
end

#callback_urlObject



45
46
47
# File 'lib/omniauth/strategies/snapchat.rb', line 45

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

#raw_infoObject



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

def raw_info
  raw_info_url = "https://adsapi.snapchat.com/v1/me"
  @raw_info ||= access_token.get(raw_info_url, mode: :header, header_format: 'Bearer %s').parsed
  @raw_info || {'me' => {}}
end

#token_paramsObject



49
50
51
52
53
54
55
56
57
# File 'lib/omniauth/strategies/snapchat.rb', line 49

def token_params
  authorization = Base64.strict_encode64("#{options.client_id}:#{options.client_secret}")
  super.merge({
    headers: {
      "Authorization" => "Basic #{authorization}"
    },
    parse: :json,
  })
end