Class: OmniAuth::Strategies::DropboxOauth2

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

Instance Method Summary collapse

Instance Method Details

#callback_urlObject



43
44
45
46
47
48
49
# File 'lib/omniauth/strategies/dropbox_oauth2.rb', line 43

def callback_url
  if @authorization_code_from_signed_request
    ''
  else
    options[:callback_url] || super
  end
end

#raw_infoObject



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/omniauth/strategies/dropbox_oauth2.rb', line 27

def raw_info
  conn = Faraday.new(:url => 'https://api.dropbox.com') do |faraday|
    faraday.request  :url_encoded             # form-encode POST params
    faraday.response :logger                  # log requests to STDOUT
    faraday.adapter  Faraday.default_adapter  # make requests with Net::HTTP
  end
  response = conn.post do |req|
    req.url '/2/users/get_current_account'
    req.headers['Content-Type'] = 'application/json'
    req.headers['Authorization'] = "Bearer #{access_token.token}"
    req.body = "null"
  end
  @raw_info ||= MultiJson.decode(response.body)
  # @raw_info ||= MultiJson.decode(access_token.get('/2/users/get_current_account').body)
end