I have a valid app_key, app_secret, and refresh_token and I'm trying to call the check_and_refresh_access_token function in the Dropbox API for Python. Here is the code...
def refresh_dropbox_token(app_key, app_secret, refresh_token):
dbx = dropbox.Dropbox(
oauth2_refresh_token=refresh_token,
app_key=app_key,
app_secret=app_secret,
)
token = dbx.check_and_refresh_access_token()
if token:
return token.access_token
else:
raise Exception("Failed to refresh access token.")
In the debugger when I examine the token variable it has the value of nothing. Just to make sure I was passing a valid refresh_token, I called this with the refresh_token received in a full oauth2 authorization process.
Any ideas on what may be wrong here? Once I do the full authorization I am able to upload files through the API, but when it expires, I want to use the refresh_token rather than taking the user back to Dropbox to authorize again.
Any help on this would be greatly appreciated!
Bob