Class: OmniAuth::Strategies::Wepay

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

Constant Summary collapse

DEFAULT_PERMISSIONS =
"manage_accounts,view_balance,collect_payments,refund_payments,view_user"

Instance Method Summary collapse

Instance Method Details

#raw_infoObject



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/omniauth/strategies/wepay.rb', line 27

def raw_info
  c_options = options.client_options

  params = {
    code: request.params['code'], 
    client_id:options.client_id, 
    redirect_uri: callback_url, 
    client_secret: options.client_secret
  }.to_param

  url = c_options[:token_url] + "?" + params

  info = access_token.post(url).parsed

  user_url = c_options[:site] + c_options[:user_path]
  
  info2 = client.request(:post, user_url) do |req|
    req.headers["Authorization"] = "Bearer #{info["access_token"]}"
  end.parsed
  
  @raw_info ||= info.merge(info2)
end