HTTPBadRequest when working with deserialized session
Closed this issue · 4 comments
using dropbox (current master, latest commit: c752471) with:
Ruby 1.8.7 (2009-06-12 patchlevel 174)
Rails 3.0.6
I get the following error when I use a deserialized session object for listing entries:
HTTP status Net::HTTPBadRequest received: http://api.dropbox.com/0/metadata/sandbox?list=true
My code handling the session initialization, serialization and deserialization looks like this:
def dropbox_session
if session[:dropbox_session]
d_session = Dropbox::Session.deserialize(session[:dropbox_session])
d_session.authorized! unless d_session.authorized?
puts d_session.inspect
d_session
else
d_session = Dropbox::Session.new('#########', '###########',
{:authorizing_user => "###########", :authorizing_password => "#####"})
d_session.mode = :dropbox
d_session.authorize!
session[:dropbox_session] = d_session.serialize
d_session
end
end
It works fine if I create new session every time I need.
Thanks for your help very much!
Note that the mode is not serialized. So it is defaulting back into sandbox mode, when you are likely trying to query dropbox mode. I agree this is an odd default, however it should help you get past this issue, by reseting the mode after deserialization.
Oh, didn't notice; I can just serialize the mode.
Should be fixed in e044f03, let me know.
Closing this.