I'm attempting to develop an application that uses the Dropbox API in python on the background (that means that the users won't know I'm using this api). The application is a control system framework, and I'm just using the API to store global settings for all instances of the application (the goal here is to make this work between different computers, that's why it must be online). So, I just need a single account to store the data (the application will handle the downloads and uploads on the background).
From the OAuth Guide, I've been able to generate my own refresh token, and store it inside the python's script, as a string.
Every time I lauch a new instance of the application, it calls the Dropbox constructor:
import dropbox
appKey = ''
appSecret = ''
refreshToken = ''
dropbox.Dropbox(app_key=appKey, app_secret=appSecret, oauth2_refresh_token=refreshToken)
Now, my question is about the usage of the refresh token and its limitations, and possible guidelines of how to use it (if there are any rules I don't about).
In my current app version, I'm never storing any access tokens in the disk. Should I do it? I mean, should I store each access token in a file, so when the user opens a new instance of the application, it should attempt a connection using the Dropbox constructor with that loaded access token, and only use the refresh token if the access token has expired?
Or is it (morally) ok to use the refresh token every single time, and blindlessly allocate new access tokens at will (at every new instance of the application) even though they expire after 4 hours?
Finally, if the answer to the first question above is a yes (that is, it's not morally ok), is there a way to save the access tokens using the python sdk? Or should I do this mannually using the built-in file handling functions?
I understand my application won't have many users. It probably won't even apply for production, but I was still curious about this topic. I tried to research it in many sites and forums, and found nothing about it.
Thanks in advance.
Carl HR.