1

美好的一天,我正在使用 gem 'rails'、'3.2.12' 和 gem 'dropbox'、:git => 'git://github.com/tonywok/dropbox.git'、:branch => 'v1'在我的应用程序中。如果我打开控制台并执行此操作:

@options = (YAML.load_file("#{Rails.root}/config/paperclipdropbox.yml")[Rails.env].symbolize_keys)
@dropbox_key = @options[:dropbox_key]
@dropbox_secret = @options[:dropbox_secret]
@dropboxsession = Dropbox::Session.new(@dropbox_key, @dropbox_secret)
  => #<Dropbox::Session 123123 (unauthorized)>
@dropboxsession.mode = :dropbox
@dropboxsession.authorize_url 
  => "https://www.dropbox.com/1/oauth/authorize?oauth_token=123123"
dropbox_session = @dropboxsession
dropbox_session.authorize
  => true
dropbox_session.upload("#{Rails.root}/config.ru", '/')

我明白了:

Dropbox::UnsuccessfulResponseError: HTTP status Net::HTTPForbidden received: https://api-content.dropbox.com/1/files/dropbox
from /home/alexandr/.rvm/gems/ruby-1.9.3-p374/bundler/gems/dropbox-7d060d5932eb/lib/dropbox/api.rb:228:in `upload'

我错过了什么?

4

1 回答 1

1

@dropboxsession.mode = :sandbox 修复了它。:sandbox 和 :dropbox 是什么意思?开发和生产?

于 2013-03-11T19:17:24.057 回答