Dear gentlemen:
I got some troubles in using the Core API in Ruby.
All codes are written according to this document: https://www.dropbox.com/developers/core/start/ruby
as below:
def new_from_dropbox
@uploads = Upload.order('created_at DESC')
@upload = Upload.new
# Install this the SDK with "gem install dropbox-sdk"
require 'dropbox_sdk'
# Get your app key and secret from the Dropbox developer website
app_key = '***'
app_secret = '***'
flow = DropboxOAuth2FlowNoRedirect.new(app_key, app_secret)
@authorize_url = flow.start()
end
def dropbox_confirm
require 'dropbox_sdk'
app_key = '***'
app_secret = '***'
flow = DropboxOAuth2FlowNoRedirect.new(app_key, app_secret)
access_token = flow.finish(code_param[:code].strip)
puts "================================"
puts access_token.inspect
client = DropboxClient.new(access_token)
puts "linked account:", client.account_info().inspect
root_metadata = client.metadata('/')
puts "metadata:", root_metadata.inspect
end
private
def code_param
params.require(:upload).permit(:code)
end
When i input the authorization code and the function dropbox_confirm try to get access_token by
access_token = flow.finish(code_param[:code].strip)
It returned an error:
Connection timed out - connect(2) for "api.dropbox.com" port 443
Anyone can help me? please.
I found some relative questions here: https://www.pythonanywhere.com/forums/topic/1806/
But that is for python.
Regards.