cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Check out the Dropbox cheat sheet for getting started in 2021 here!

Discuss Dropbox Developer & API

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Authentication tokens keep expiring

Authentication tokens keep expiring

Explorer | Level 4

I've got some python code that uploads files to my dropbox folder, but I must be doing something wrong, because my authentication tokens keep expiring, despite multiple claims that these tokens should be long-lived.

I'm not using the test-api, but rather I did the following:

dbx_oauth = dropbox.oauth.DropboxOAuth2FlowNoRedirect(DROPBOX_APP_KEY, DROPBOX_APP_SECRET)
url_for_oauth = dbx_oauth.start()
print(url_for_oauth)
# Follow the link, get a short code, copy it, and paste into the finish method:
oauth_result = dbx_oauth.finish('SomeCodeOrOtherBlahBlahBlah')
print(oauth_result.access_token)
# I now have a TOKEN that I use for the rest of the day...

But as mentioned, this token expires and it's driving me nuts because it's messing up my work-flow.

What am I doing wrong?

Also, being the "owner" of my dropbox account, couldn't I bypass this whole token thing by using my app-key and and app-secret directly somehow??

 

Thanks!

1 Reply 1

Re: Authentication tokens keep expiring

Dropboxer

Previously, Dropbox API access tokens did not expire, but we have begun moving to a new model of using short-lived access tokens with refresh tokens. You can find more information here.

 

If you do need long-term access, you should migrate to using "refresh tokens", by requesting "offline" access. Make sure you're using the latest version of the Python SDK. You can find an example of requesting "offline" access here.

Polls
Are you starting new work habits this year?

Work Smarter with Dropbox

The way we work is changing. Share and discover new ways to work smarter with Dropbox in our community.

Sound good? Let's get started.
Who's talking

Top contributors to this post

What do Dropbox user levels mean?
Need more support?