We are aware of the issue with the badge emails resending to everyone, we apologise for the inconvenience - learn more here.
Forum Discussion
Pelleman
3 years agoExplorer | Level 4
How to create oauth2 access token from code?
Hello, I have written a backup solution and want to automatically post the backup file (a zip) to my Dropbox account every day when backup finishes.
How can I create an auth2 token by code and use ...
- 3 years ago
Hi Pelleman,
Access token received in whatever way is short lived and can't be used alone for a long time (4 hours, at most). For long term access (solution) you need to get to and store refresh token, which doesn't expire automatically. This token could be used to regenerate access token on demand and use the access token while valid for all regular API calls. For more info how you can get to such a refresh token and how you can automate "refreshing", take a look here. 😉
Hope this helps.
Pelleman
3 years agoExplorer | Level 4
I should add that I have spent a few hours trying to use
https://api.dropboxapi.com/oauth2/token
but it does not seem to provide a way to actually create a fully automated flow based on just the app id and secret. I don't want the step where a user has to open a browser or use some silly intermediary/proxy web server to make additional requests. It would not improve security in my project.
So I want to
1. "Login" automatically in my code to dropbox, based on credentials saved in a file, to get the Oauth2 access code to use in step 2.
2. Upload my file using the Oauth2 access code
Is this even possible? Or should I look at other solutions/storage applications which allows a fully automated flow? Please provide an elaborated answer on how to achieve steps 1 and 2. Thanks!
- Здравко3 years agoLegendary | Level 20
Hi Pelleman,
Access token received in whatever way is short lived and can't be used alone for a long time (4 hours, at most). For long term access (solution) you need to get to and store refresh token, which doesn't expire automatically. This token could be used to regenerate access token on demand and use the access token while valid for all regular API calls. For more info how you can get to such a refresh token and how you can automate "refreshing", take a look here. 😉
Hope this helps.
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
5,877 PostsLatest Activity: 12 months 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!