Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Access tokens no longer long lived #66

Open
johnsturgeon opened this issue Mar 19, 2022 · 8 comments
Open

Access tokens no longer long lived #66

johnsturgeon opened this issue Mar 19, 2022 · 8 comments

Comments

@johnsturgeon
Copy link

After getting 'access denied, token expired' errors constantly for the last few days I checked my access token, and it's gone, along with the option to set the 'expiration policy'

I sent a message to Dropbox and this is their answer:

Hi John,

Dropbox is in the process of switching to only issuing short-lived access tokens (and optional refresh tokens) instead of long-lived access tokens. You can find more information on this migration here.

Apps can still get long-term access by requesting "offline" access though, in which case the app receives a "refresh token" that can be used to retrieve new short-lived access tokens as needed, without further manual user intervention. You can find more information in the OAuth Guide and authorization documentation.

For reference, while the creation of new long-lived access tokens is now deprecated, we don't currently have a plan to disable existing long-lived access tokens. (If that changes, we will of course announce that ahead of time.) That being the case, you can continue using existing long-lived access token(s) without interruption, if you have any. Also, note though that after the change you won't be able to create new long-lived access tokens.

While the change began on September 30th 2021, we're releasing it gradually, so you may not have seen your app(s) affected until now. Once it applies to your app, it would apply regardless of the "Access token expiration" setting for your app, and that setting may no longer be available for your app.

Note that this is something that would need to be implemented by the programmer of the app though, so if you are not the programmer responsible for this integration, you may need to get an update from them to support this.

Regards,
Moe

@d0ugal
Copy link
Owner

d0ugal commented Mar 19, 2022

Interesting. That does look like it could be a problem for everyone soon

@creedda
Copy link

creedda commented Nov 5, 2022

Looks like its the case now. Getting errors and only resolution is to replace the access token when it expires.

s6-rc: info: service s6rc-oneshot-runner: starting
s6-rc: info: service s6rc-oneshot-runner successfully started
s6-rc: info: service fix-attrs: starting
s6-rc: info: service fix-attrs successfully started
s6-rc: info: service legacy-cont-init: starting
s6-rc: info: service legacy-cont-init successfully started
s6-rc: info: service legacy-services: starting
s6-rc: info: service legacy-services successfully started
[14:29:23] INFO: Starting Dropbox Upload script...
Unable to refresh access token without                 refresh token and app key
Traceback (most recent call last):
  File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/app/dropbox_upload/__main__.py", line 60, in <module>
    main(config.DEFAULT_CONFIG)
  File "/app/dropbox_upload/__main__.py", line 36, in main
    dbx.users_get_current_account()
  File "/usr/lib/python3.10/site-packages/dropbox/base.py", line 5263, in users_get_current_account
    r = self.request(
  File "/usr/lib/python3.10/site-packages/dropbox/dropbox.py", line 313, in request
    res = self.request_json_string_with_retry(host,
  File "/usr/lib/python3.10/site-packages/dropbox/dropbox.py", line 463, in request_json_string_with_retry
    return self.request_json_string(host,
  File "/usr/lib/python3.10/site-packages/dropbox/dropbox.py", line 578, in request_json_string
    raise AuthError(request_id, err)
dropbox.exceptions.AuthError: AuthError('cae9a41868444f72a9ca01ce0c17f4a8', AuthError('expired_access_token', None))
s6-rc: info: service legacy-services: stopping
s6-rc: info: service legacy-services successfully stopped
s6-rc: info: service legacy-cont-init: stopping
s6-rc: info: service legacy-cont-init successfully stopped
s6-rc: info: service fix-attrs: stopping
s6-rc: info: service fix-attrs successfully stopped
s6-rc: info: service s6rc-oneshot-runner: stopping
s6-rc: info: service s6rc-oneshot-runner successfully stopped

@creedda
Copy link

creedda commented Nov 5, 2022

Looks like its the case now. Getting errors and only resolution is to replace the access token when it expires.

s6-rc: info: service s6rc-oneshot-runner: starting
s6-rc: info: service s6rc-oneshot-runner successfully started
s6-rc: info: service fix-attrs: starting
s6-rc: info: service fix-attrs successfully started
s6-rc: info: service legacy-cont-init: starting
s6-rc: info: service legacy-cont-init successfully started
s6-rc: info: service legacy-services: starting
s6-rc: info: service legacy-services successfully started
[14:29:23] INFO: Starting Dropbox Upload script...
Unable to refresh access token without                 refresh token and app key
Traceback (most recent call last):
  File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/app/dropbox_upload/__main__.py", line 60, in <module>
    main(config.DEFAULT_CONFIG)
  File "/app/dropbox_upload/__main__.py", line 36, in main
    dbx.users_get_current_account()
  File "/usr/lib/python3.10/site-packages/dropbox/base.py", line 5263, in users_get_current_account
    r = self.request(
  File "/usr/lib/python3.10/site-packages/dropbox/dropbox.py", line 313, in request
    res = self.request_json_string_with_retry(host,
  File "/usr/lib/python3.10/site-packages/dropbox/dropbox.py", line 463, in request_json_string_with_retry
    return self.request_json_string(host,
  File "/usr/lib/python3.10/site-packages/dropbox/dropbox.py", line 578, in request_json_string
    raise AuthError(request_id, err)
dropbox.exceptions.AuthError: AuthError('cae9a41868444f72a9ca01ce0c17f4a8', AuthError('expired_access_token', None))
s6-rc: info: service legacy-services: stopping
s6-rc: info: service legacy-services successfully stopped
s6-rc: info: service legacy-cont-init: stopping
s6-rc: info: service legacy-cont-init successfully stopped
s6-rc: info: service fix-attrs: stopping
s6-rc: info: service fix-attrs successfully stopped
s6-rc: info: service s6rc-oneshot-runner: stopping
s6-rc: info: service s6rc-oneshot-runner successfully stopped

Unable to refresh access token without refresh token and app key

This line suggests somewhere in the code its been updated to work with an app key and refresh token. any ideas on how to expose that?

@sergiograndini
Copy link

I'm facing the same problem here, any luck?

@wrenoud
Copy link

wrenoud commented Dec 26, 2022

I'm facing the same problem here, any luck?

I have switched to the Google drive backup. It's much more than I want in terms of features, but it works well.

I looked a little at the code here, but all the magic is really in the bash script which is managed in a different repository with a different maintainer. And it doesn't appear the bash script is getting maintenance. I would say ideally the Dropbox API logic would get moved into this repository and into python. I'm also hesitant to try and make a PR because I'm not clear the maintainer here is actively maintaining. And I haven't developed HA add-ons yet so I'm not quite sure how to approach it.

@d0ugal
Copy link
Owner

d0ugal commented Dec 26, 2022

There is no bash script here so I think you are confused. This is a pure Python Dropbox project

I am the original author but I don’t use it now. I moved away from the full so or supervised install.

I’d be delighted if somebody would take over and I would help them do that how I can.

@wrenoud
Copy link

wrenoud commented Dec 26, 2022

@d0ugal I conflated this with the other repo https://github.com/danielwelch/hassio-dropbox-sync. Apologies!

@d0ugal
Copy link
Owner

d0ugal commented Dec 26, 2022

No problem, it’s a bit confusing 😅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants