dropbox icon indicating copy to clipboard operation
dropbox copied to clipboard

401 Unauthorized

Open simicic opened this issue 13 years ago • 10 comments

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! ;)

simicic avatar Oct 28 '11 11:10 simicic

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

cfiorini avatar Nov 03 '11 15:11 cfiorini

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)

crystalneth avatar Nov 03 '11 23:11 crystalneth

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?)

jonthewayne avatar Nov 18 '11 11:11 jonthewayne

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."}

rmoriz avatar Nov 21 '11 21:11 rmoriz

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

crystalneth avatar Nov 22 '11 20:11 crystalneth

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

crystalneth avatar Nov 22 '11 20:11 crystalneth

@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.

artur79 avatar Jan 20 '12 08:01 artur79

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, [email protected] 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

crystalneth avatar Jan 20 '12 15:01 crystalneth

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

artur79 avatar Jan 23 '12 09:01 artur79

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

Sent from my iPhone

On Jan 23, 2012, at 1:05 AM, [email protected] 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

crystalneth avatar Jan 23 '12 17:01 crystalneth