RISCfuture / dropbox

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

Staying authorized #35

Closed jonallured closed 13 years ago

jonallured commented 13 years ago

I have a script that I'm writing to compare files on a webpage with files in my Dropbox. That script is authorized to access my Dropbox account, but I'm unclear how I should use this authorization. The basic example uses this flow:

  1. create a session object
  2. print the authorization url for the user to click on and authorize the app
  3. call authorize on session to be able to use it

And that's great the first time, but once your app is authorized the first time, how are you supposed to get authorized the next time? Doing the above every time seems like the wrong way, but I can't figure out how I'm supposed to do this.

How can my script stay authorized or use the fact that its already been authorized once?

RISCfuture commented 13 years ago

Serialize the session object using the #serialize method, then store it somewhere. When you later deserialize it, it will still be authorized.