I may not be fully understanding this, but here's the issue. I'm trying to get a short-lived token that can be used repeatedly. The first time through, I am prompting through the command line. I can get the token from Dropbox and when I test it (using files_list_folder) it works.
However, if I try to then use that token on subsequent Dropbox API calls, I get invalid_access_token.
Here is the code I am using to get the access token.
def get_token_no_redirect(self):
oauth_result = ""
auth_flow = oauth.DropboxOAuth2FlowNoRedirect(consumer_key=self.app_key, consumer_secret=self.app_secret,
token_access_type="offline")
authorize_url = auth_flow.start()
print(f"1. Go to: {authorize_url})")
print("2. Click \\Allow\\ (you might have to log in first).")
print("3. Copy the authorization code.")
auth_code = input("Enter the authorization code here: ").strip()
try:
oauth_result = auth_flow.finish(auth_code)
except Exception as e:
print('Error: %s' % (e,))
return oauth_result
I also tried this sending "online" instead but still got the error.
Is there another way to get a token that can then be used on future requests?