Skip to content

Commit 8c487d8

Browse files
committed
Fix Dropbox API v2 post request
1 parent 9cbe6e4 commit 8c487d8

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

lib/omniauth/strategies/dropbox_oauth2.rb

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,19 @@ class DropboxOauth2 < OmniAuth::Strategies::OAuth2
2525
end
2626

2727
def raw_info
28-
@raw_info ||= MultiJson.decode(access_token.get('/2/users/get_current_account').body)
28+
conn = Faraday.new(:url => 'https://api.dropbox.com') do |faraday|
29+
faraday.request :url_encoded # form-encode POST params
30+
faraday.response :logger # log requests to STDOUT
31+
faraday.adapter Faraday.default_adapter # make requests with Net::HTTP
32+
end
33+
response = conn.post do |req|
34+
req.url '/2/users/get_current_account'
35+
req.headers['Content-Type'] = 'application/json'
36+
req.headers['Authorization'] = "Bearer #{access_token.token}"
37+
req.body = "null"
38+
end
39+
@raw_info ||= MultiJson.decode(response.body)
40+
# @raw_info ||= MultiJson.decode(access_token.get('/2/users/get_current_account').body)
2941
end
3042

3143
def callback_url

0 commit comments

Comments
 (0)