We are aware of the issue with the badge emails resending to everyone, we apologise for the inconvenience - learn more here.
Forum Discussion
amelesko
2 months agoHelpful | Level 5
API access with refresh_token in python
I have an app that I built in python and I'm trying to have sustained access to read from files in a folder
I've gone through the entire process of getting the user (myself) to sign in and get ...
- 2 months ago
Well I solved this and was just being dumb. Sorry for any confusion
It turns out that just proceeding with
dbx = dropbox.Dropbox(oauth2_refresh_token=refresh_token, app_key=app_key, app_secret=app_secret)
works as it should
My mistake was saving the refresh_token to a DB and pulling it from there (I removed that step in my example code here to be more concise), and the DB was automatically removing a couple ending characters from the token
amelesko
2 months agoHelpful | Level 5
As a quick update, I did expand the error code and am seeing it says "refresh token is malformed". I found this thread . That thread claims that the token obtained from a curl call is not the refresh_token. However, I am not getting my token that same way, I get it from DropboxOAuth2FlowNoRedirect by explicitly referencing .refresh_token.
Here is my initial code to get the refresh_token:
auth_flow = DropboxOAuth2FlowNoRedirect(
app_key, app_secret,
token_access_type='offline')
authorize_url = auth_flow.start()
st.write("1. Go to: " + authorize_url)
st.write("2. Click 'Allow' (you might have to log in first)")
st.write("3. Copy the authorization code")
auth_code = st.text_input("Enter the authorization code here:")
auth_result = auth_flow.finish(auth_code)
refresh_token, access_token = auth_result.refresh_token, auth_result.access_token
Not sure if this is helpful in understanding what is going on, but figured I would share it in case
- amelesko2 months agoHelpful | Level 5
Well I solved this and was just being dumb. Sorry for any confusion
It turns out that just proceeding with
dbx = dropbox.Dropbox(oauth2_refresh_token=refresh_token, app_key=app_key, app_secret=app_secret)
works as it should
My mistake was saving the refresh_token to a DB and pulling it from there (I removed that step in my example code here to be more concise), and the DB was automatically removing a couple ending characters from the token
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!