RISCfuture / dropbox

An easy-to-use client library for the official Dropbox API.
MIT License
519 stars 47 forks source link

401 Unauthorized #45

Open simicic opened 12 years ago

simicic commented 12 years ago

Hi!

I have a very basic issue using this gem and I haven't figure out yet what is actually wrong. Maybe someone had the same problem?

So, configuration is: rails (2.3.11) ruby-1.9.2-p290 oauth (0.4.5) dropbox (1.3.0) (...)

controller action fails at this line (yes, very first, APP_KEY and APP_SECRET are the values obtained at dropbox pages):

dropbox_session = Dropbox::Session.new(APP_KEY, APP_SECRET)

it results with: 401 Unauthorized

and application trace... .../gems/oauth-0.4.5/lib/oauth/consumer.rb:219:in 'token_request' .../gems/oauth-0.4.5/lib/oauth/consumer.rb:139:in 'get_request_token' .../gems/dropbox-1.3.0/lib/dropbox/session.rb:70:in 'initialize' .../app/controllers/files_controller.rb:94:in 'new' .../app/controllers/files_controller.rb:94:in 'authorize'

when am trying to initialize session using dropbox_sdk.rb file things are working (but I prefer using gems)

what am I doing wrong? can someone give me a hint because I am running out of ideas! Thanks a lot! ;)

cfiorini commented 12 years ago

i figured out using this https://github.com/tonywok/dropbox/commit/10fc9d12cb51629305c313395acb94f73bc3f20d

crystalneth commented 12 years ago

Looks like this gem is completely broken right now... I had to switch to

gem 'dropbox', :git => 'git://github.com/tonywok/dropbox.git', :branch => 'v1'

for the time being (I'm in early stage development, so this is fine right now)

jonthewayne commented 12 years ago

I tried using the dropbox gem in IRB and got the same error:

ruby-1.8.7-p249 > require 'dropbox' => true ruby-1.8.7-p249 > session = Dropbox::Session.new('hidden', 'hidden') OAuth::Unauthorized: 401 Unauthorized from /home/bandega/ruby/gems/gems/oauth-0.4.5/lib/oauth/consumer.rb:219:in token_request' from /home/bandega/ruby/gems/gems/oauth-0.4.5/lib/oauth/consumer.rb:139:inget_request_token' from /home/bandega/ruby/gems/gems/dropbox-1.3.0/lib/dropbox/session.rb:70:in initialize' from (irb):3:innew' from (irb):3

Any ideas what is up? I'm trying to connect to my own app, which is in Development status (app is on same account I'm saving to though, so that should be cool, right?)

rmoriz commented 12 years ago

OAuth response.body is:

{"error": "You're using an older version of the Dropbox API with a new API key. Please use the latest version."}

crystalneth commented 12 years ago

This is because of an update to the Dropbox API in v1.0. Personally I switched to the official Dropbox API.

crystalneth commented 12 years ago

All new applications will be broken with this gem until the gem is fixed.

artur79 commented 12 years ago

@allix: you mean all the new applications set up via Dropbox site ? Which gem you use now ? I have the same problem, but I've found it rather fails on oauth lib level, before even dropbox gem is used. Application trace is empty, but full trace starts with:

oauth (0.4.5) lib/oauth/consumer.rb:219:in token_request' oauth (0.4.5) lib/oauth/consumer.rb:139:inget_request_token' oa-oauth (0.3.2) lib/omniauth/strategies/oauth.rb:31:in request_phase' oa-core (0.3.2) lib/omniauth/strategy.rb:58:inrequest_call' oa-core (0.3.2) lib/omniauth/strategy.rb:41:in call!' oa-core (0.3.2) lib/omniauth/strategy.rb:30:incall'

When switching to Dropbox credentials set up some time ago, it works. Like old and new Dropbox app behave different.

crystalneth commented 12 years ago

Yes. New applications are required to do things the new way. I switched to the official gem.

Sent from my iPhone

On Jan 20, 2012, at 12:53 AM, Arturreply@reply.github.com wrote:

allix: you mean all the new applications set up via Dropbox site ? Which gem you use now ?


Reply to this email directly or view it on GitHub: https://github.com/RISCfuture/dropbox/issues/45#issuecomment-3580679

artur79 commented 12 years ago

I see. Have you tried that gem https://github.com/futuresimple/dropbox-api, also mentioned here https://www.dropbox.com/developers/reference/sdk, looks promising

crystalneth commented 12 years ago

Perfectly fine with the official one. See no need to switch.

Sent from my iPhone

On Jan 23, 2012, at 1:05 AM, Arturreply@reply.github.com wrote:

I see. Have you tried that gem https://github.com/futuresimple/dropbox-api, also mentioned here https://www.dropbox.com/developers/reference/sdk, looks promising


Reply to this email directly or view it on GitHub: https://github.com/RISCfuture/dropbox/issues/45#issuecomment-3610887