You might see that the Dropbox Community team have been busy working on some major updates to the Community itself! So, here is some info on what’s changed, what’s staying the same and what you can expect from the Dropbox Community overall.
Forum Discussion
lubernar
8 months agoExplorer | Level 3
Invalid grant trying to get refresh token
Hello,
I want to catch changes that have been made in a spreadsheet in Dropbox by checking every 5 minutes.
I am using python and I tried this code:
f'response_type=code&token_access_type=offline'
Here I copy the code displayed on the webpage. This is my ACCESS_CODE_GENERATED.
Ant then I type:
BASIC_AUTH = base64.b64encode(f'{APP_KEY}:{APP_SECRET}'.encode())
headers = {
'Authorization': f"Basic {BASIC_AUTH}",
'Content-Type': 'application/x-www-form-urlencoded',
}
data = f'code={ACCESS_CODE_GENERATED}&grant_type=authorization_code'
data=data,
auth=(APP_KEY, APP_SECRET))
print(json.dumps(json.loads(response.text), indent=2))
And the output I get is
{ "error": "invalid_grant", "error_description": "code doesn't exist or has expired" }
I don't understand what is not working.
I would appreciate any help, thanks
- ЗдравкоLegendary | Level 20
Hi lubernar,
First of all, how long take between access code getting and using it? 🧐 This code is for single use only and is short lived 10~15mins. It sounds like, you kept it too long before usage.
Next thing, not signaled yet is usage of multiple basic authorizations at the same time (2 ways of all possible while 1 is needed and enough). By the way why you don't use the official Dropbox Python SDK? It would be easier. 😉
Good luck.
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
5,888 PostsLatest Activity: 5 hours agoIf you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X or Facebook.
For more info on available support options for your Dropbox plan, see this article.
If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!