RISCfuture/dropbox

Staying authorized

jonallured opened this issue · 1 comments

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?

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