maestral icon indicating copy to clipboard operation
maestral copied to clipboard

Authentication failed Please make sure that you entered the correct authentication code.

Open tjluoma opened this issue 3 years ago • 13 comments

Describe the bug

I keep seeing an alert box telling me

Authentication failed Please make sure that you entered the correct authentication code.

I think this is actually being caused by an issue with the Dropbox API, because the app has been working fine and authorized for a long time now.

When it happens, maestral pauses.

To Reproduce

I don’t know how to make it happen but I have seen it repeatedly today.

Expected behaviour

No such error message

System:

  • Maestral version: 150 (35)
  • Python version: Python 3.9.7
  • OS: [e.g. Ubuntu] macOS version 12.0.1 (21A558)
  • Desktop environment: macOS version 12.0.1 (21A558)
  • PyQt version (for Linux GUI): n/a

Additional context

This happened on both my M1 Mac mini and MacBook Air. Both running the same version of macOS (which is Monterey beta, to be clear)

tjluoma avatar Oct 20 '21 00:10 tjluoma

Started having the same issue today as well.

Version 1.5.0 (35) Mac OS 11.6 (20G165)

dunkoh avatar Oct 20 '21 02:10 dunkoh

Same. Re-authenticating with the following did not help:

maestral auth link --relink

Roy-Orbison avatar Oct 20 '21 03:10 Roy-Orbison

Same. Trying to download a relatively small existing Dropbox folder on initial setup is now nearly impossible: I keep manually resuming sync, seeing a little progress, and then seeing the authentication error again.

As a quality-of-life mitigation, I suggest that maestral not completely pause syncing when it encounters an authentication error but rather wait & retry.

duncanbrook avatar Oct 20 '21 04:10 duncanbrook

Same here; I tried re-authenticating into Dropbox; it succeeds, then some minutes later, I get the error in the OP's screenshot.

dantsai avatar Oct 20 '21 04:10 dantsai

I don’t know how to make it happen but I have seen it repeatedly today.

Same here. I tried unlinking and relinking to my Dropbox account in the GUI, didn't seem to help at all either.

ShredderWalnut avatar Oct 20 '21 04:10 ShredderWalnut

Same here

fatlazycat avatar Oct 20 '21 07:10 fatlazycat

Same issue on Ubuntu 20.04. Here's what I see in the shell:

INFO:maestral.sync:Indexing remote Dropbox
INFO:maestral.sync:Indexing 500...
INFO:maestral.sync:Creating folders...
INFO:maestral.sync:Creating folder 1/3...
INFO:maestral.sync:Syncing ↓ 133/420
INFO:maestral.sync:Syncing ↓ 169/420
INFO:maestral.sync:Indexing 1000...
INFO:maestral.sync:Creating folders...
INFO:maestral.sync:Creating folder 1/8...
INFO:maestral.sync:Syncing ↓ 2/474
INFO:maestral.sync:Syncing ↓ 8/474
INFO:maestral.sync:Syncing ↓ 27/474
INFO:maestral.sync:Syncing ↓ 30/474
INFO:maestral.sync:Syncing ↓ 31/474
ERROR:root:A message handler raised an exception: invalid literal for int() with base 10: 'default'.
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/dist-packages/dbus_next/message_bus.py", line 668, in _process_message
    result = handler(msg)
  File "/usr/local/lib/python3.8/dist-packages/dbus_next/proxy_object.py", line 101, in _message_handler
    cb_result = handler(*body)
  File "/usr/local/lib/python3.8/dist-packages/desktop_notifier/dbus.py", line 196, in _on_action
    button_number = int(action_key)
ValueError: invalid literal for int() with base 10: 'default'

INFO:maestral.sync:Syncing ↓ 62/474
ERROR:maestral.manager:Authentication failed
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/dist-packages/maestral/client.py", line 126, in convert_api_errors
    yield
  File "/usr/local/lib/python3.8/dist-packages/maestral/client.py", line 617, in download
    md, http_resp = self.dbx.files_download(dbx_path, **kwargs)
  File "/usr/local/lib/python3.8/dist-packages/dropbox/base.py", line 1284, in files_download
    r = self.request(
  File "/usr/local/lib/python3.8/dist-packages/dropbox/dropbox_client.py", line 301, in request
    self.check_and_refresh_access_token()
  File "/usr/local/lib/python3.8/dist-packages/dropbox/dropbox_client.py", line 369, in check_and_refresh_access_token
    self.refresh_access_token(scope=self._scope)
  File "/usr/local/lib/python3.8/dist-packages/dropbox/dropbox_client.py", line 409, in refresh_access_token
    res.raise_for_status()
  File "/usr/lib/python3/dist-packages/requests/models.py", line 940, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: https://api.dropboxapi.com/oauth2/token

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/lib/python3.8/dist-packages/maestral/manager.py", line 791, in _handle_sync_thread_errors
    yield
  File "/usr/local/lib/python3.8/dist-packages/maestral/manager.py", line 769, in startup_worker
    self.sync.download_sync_cycle(client)
  File "/usr/local/lib/python3.8/dist-packages/maestral/sync.py", line 2836, in download_sync_cycle
    downloaded = self.apply_remote_changes(changes)
  File "/usr/local/lib/python3.8/dist-packages/maestral/sync.py", line 3004, in apply_remote_changes
    for n, r in enumerate(res):
  File "/usr/lib/python3.8/concurrent/futures/_base.py", line 619, in result_iterator
    yield fs.pop().result()
  File "/usr/lib/python3.8/concurrent/futures/_base.py", line 437, in result
    return self.__get_result()
  File "/usr/lib/python3.8/concurrent/futures/_base.py", line 389, in __get_result
    raise self._exception
  File "/usr/lib/python3.8/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/local/lib/python3.8/dist-packages/maestral/sync.py", line 3328, in _create_local_entry
    res = self._on_remote_file(event, client)
  File "/usr/local/lib/python3.8/dist-packages/maestral/sync.py", line 3387, in _on_remote_file
    md = client.download(f"rev:{event.rev}", tmp_fname, sync_event=event)
  File "/usr/local/lib/python3.8/dist-packages/maestral/client.py", line 635, in download
    os.utime(local_path, (time.time(), timestamp))
  File "/usr/lib/python3.8/contextlib.py", line 131, in __exit__
    self.gen.throw(type, value, traceback)
  File "/usr/local/lib/python3.8/dist-packages/maestral/client.py", line 128, in convert_api_errors
    raise dropbox_to_maestral_error(exc, dbx_path, local_path)
maestral.errors.DropboxAuthError: Authentication failed. Please make sure that you entered the correct authentication code.
INFO:maestral.manager:Shutting down threads...
INFO:maestral.sync:Sync aborted
INFO:maestral.manager:Paused

mikesname avatar Oct 20 '21 07:10 mikesname

This appears to be glitch with Dropbox servers occasionally rejecting valid access tokens. I've reported the issue and they are investigating.

samschott avatar Oct 20 '21 08:10 samschott

@SamSchott Is there a better work-around than resuming sync manually at each authentication fail?

gukj avatar Oct 20 '21 08:10 gukj

@SamSchott Is there a better work-around than resuming sync manually at each authentication fail?

stick this in a file: #!/bin/bash maestral status | grep fail > /dev/null if [ $? -eq 0 ] then maestral stop && maestral start else maestral status | grep "daemon is not" > /dev/null if [ $? -eq 0 ] then maestral start fi fi

Mark it as executable (chmod +x )

and run it in a infinite loop: while :;do ./;sleep 1;done

you can then also quit the app entirely from the GUI to avoid getting the popup messages constantly.

Effectively what it does is is restart the app each time the auth error appears and then restarts the daemon. a bit clunky but at least I can sync again until it is resolved

cyberatz avatar Oct 20 '21 10:10 cyberatz

@SamSchott Is there a better work-around than resuming sync manually at each authentication fail?

I asked roughly the same question a bit earlier and think @SamSchott already may have addressed it in the next version?

duncanbrook avatar Oct 20 '21 23:10 duncanbrook

Seems like the issue is solved at this moment.

EdogawaKun avatar Oct 21 '21 11:10 EdogawaKun

Hard to tell if it's fixed in the app or if Dropbox is just not throwing the error.

tjluoma avatar Oct 21 '21 11:10 tjluoma

Closing since this was likely a temporary issue on the Dropbox side.

samschott avatar May 16 '23 20:05 samschott