I'm maintaining a Java Desktop application that can use Dropbox to store user data.
I've just discovered that my Dropbox integration doesn't work anymore for new users because of the API breaking change about long-lived tokens (I am not saying it was a wrong decision, security matters ??).
Previously, my application stored the long-lived user token in a preference file in order to prevent the user from having to log in to Dropbox every time he launches the application. My goal is to prevent the user from having to log in to Dropbox every time he launches the application even with short-lived tokens/refresh-tokens.
I understood how to get a refresh token and pass it to the java API through a DbxCredential in DbxClientV2 constructor. I also understood that the client will then refresh the token when needed (when it is about to expire or refused by Dropbox's server).
Nevertheless, I wonder how to know when the access/refresh tokens are refreshed/changed in order to save them again in the preference file.
I found no "token refresh" event I could register (maybe there is no such thing).
The only solution I found is to subclass DbxClientV2 and override its refreshAccessToken method.
Is there is a cleaner way?