Closed ghost closed 11 years ago
Hi there!
From what you tell me this is an authentication problem. Dropbox states:
"401 Bad or expired token. This can happen if the user or Dropbox revoked or expired an access token. To fix, simply re-authenticate the user."
Check out your dropbox.log for any error messages. It should be in the same folder as pyfusebox.log and should read something like:
get Authenticator
get access_token: for: username password
get DropboxClient
getting time difference
api initialized
Right now I don't get why your token could have expired. I am trying to reproduce your problem, but so far I failed. I tried to get a similar error message by giving a wrong password, username, and secret key, but it looks different. Maybe if I wait a really long time before copying the config file.. But as far as I can remember the client simply reauthenticates automatically, if such an error occurs. Until then you might simply want to try again by first restarting the filesystem:
fusermount -zu mnt/
python -m cloudfusion.main mnt
And finally copying your config file to mnt/config/config with cp.
Maybe if I wait a really long time before copying the config file..
Nope, this didn't work either. But I just remembered that there was a similar problem when using your account on the same computer twice. So when you log in the second time with the same account, the token you get the first time expires automatically. To make sure this is not the problem, shutdown any dropbox related application on your pc including any running Cloudfusion mounts, and restart the filesystem. To check if Cloudfusion is running, use the command
mount
Which will give you a list of mountpoints. If Cloudfusion is active the output contains a line:
ConfigurablePyFuseBox on /mountdirectory type fuse ...
Hi,
Thanks for your reply. Just to make sure I didn't do anything stupid, I rebooted my VM to ensure there were no stale mounts around and reinstalled CloudFusion according to your README. I've also double-checked the username/password, app key and app secret. I'm only logged into DropBox through the DropBox website and no DropBox client is installed on the VM.
I'm still getting the same 401 error (I've XXX the passwords below in the logs). I take it there is no error message provided by the DropBox API that explains the reason for the 401?
$ cat pyfusebox.log 2013-02-02 13:58:39,438 - pyfusebox - DEBUG - initialized configurable pyfusebox 2013-02-02 13:58:39,438 - pyfusebox - INFO - PyFuseBox initialized 2013-02-02 13:59:10,922 - pyfusebox - DEBUG - getattr / ... 2013-02-02 14:00:10,955 - pyfusebox - DEBUG - getattr /config 2013-02-02 14:00:10,961 - pyfusebox - DEBUG - open /config/config 2013-02-02 14:00:10,962 - pyfusebox - DEBUG - truncate /config/config to 0 2013-02-02 14:00:10,962 - pyfusebox - DEBUG - getattr /config/config 2013-02-02 14:00:11,489 - pyfusebox - DEBUG - write /config/config ... starting with [auth] se at 0 - fh: 0 2013-02-02 14:00:11,490 - pyfusebox - DEBUG - writing to virtual file /config/config 2013-02-02 14:00:11,490 - pyfusebox - DEBUG - write [auth] server = api.dropbox.com content_server = api-content.dropbox.com port = 80
request_token_url = https://api.dropbox.com/0/oauth/request_token access_token_url = https://api.dropbox.com/0/oauth/access_token authorization_url = https://www.dropbox.com/0/oauth/authorize trusted_access_token_url = https://api.dropbox.com/0/token
_# the root of Dropbox operations. should be either dropbox or sandbox root = dropbox
_# key and secret can be obtained by creating an app on the dropbox website consumer_key = XXX consumer_secret = XXX
user = XXX@gmail.com password = XXX
[store] name = dropbox cache = 60 metadata_cache = 60
to 0 2013-02-02 14:00:11,490 - pyfusebox - DEBUG - wrote 678 bytes starting with [auth] server = api.dropbox.c... 2013-02-02 14:00:11,490 - pyfusebox - DEBUG - written bytes:678 2013-02-02 14:00:11,490 - pyfusebox - DEBUG - _initialize_store: 2013-02-02 14:00:11,492 - pyfusebox - DEBUG - got service name 2013-02-02 14:00:11,492 - pyfusebox - DEBUG - got cache parameter 2013-02-02 14:00:11,493 - pyfusebox - DEBUG - got auth data: {'password': 'XXX', 'authorization_url': 'https://www.dropbox.com/0/oauth/authorize', 'consumer_key': 'XXX', 'content_server': 'api-content.dropbox.com', 'consumer_secret': 'XXX, 'trusted_access_token_url': 'https://api.dropbox.com/0/token', 'user': 'XXX@gmail.com', 'request_token_url': 'https://api.dropbox.com/0/oauth/request_token', 'server': 'api.dropbox.com', 'root': 'dropbox', 'port': '80', 'access_token_url': 'https://api.dropbox.com/0/oauth/access_token'} 2013-02-02 14:00:11,493 - pyfusebox - DEBUG - __get_new_store: 2013-02-02 14:00:11,493 - pyfusebox - DEBUG - get dropbox store 2013-02-02 14:00:11,914 - pyfusebox - DEBUG - Invalid response code 401 2013-02-02 14:00:11,914 - pyfusebox - DEBUG - got dropbox store 2013-02-02 14:00:12,129 - pyfusebox - DEBUG - flush /config/config - fh: 0 2013-02-02 14:00:12,130 - pyfusebox - DEBUG - release /config/config - fh: 0
$ cat dropbox.log 2013-02-02 14:00:11,493 - dropbox - DEBUG - get Authenticator 2013-02-02 14:00:11,494 - dropbox - DEBUG - get access_token: for: XXX@gmail.com XXX
One thing I forgot to mention was the error:
cp: writing `./config': Bad address
When I copied the config file onto the existing config file. However when I cat the new config file, it shows my copied config.
At least I can tell where the error originated. It comes from a 401 error code received in the dropbox development kit within the method called fetch_access_token: https://github.com/joe42/CloudFusion/blob/master/cloudfusion/cloudfusion/dropbox/auth.py To get more information about the error, you could change the line
assert response.status == 200, "Invalid response code %d" % response.status
to
assert response.status == 200, "Invalid response code %d, \nreason %s" % (response.status, response.reason)
It turns out that you can have several instances of the same dropbox account running on the same pc, so that cannot be the problem, which leaves me clueless for the moment as to what the problem actually is. The command line error just indicates, that something went wrong, when copying the config file, which is the failed authentication. The problem is that there is no good way to indicate the actual error with one of the common file operation error messages. But I think like this you at least know that something went wrong.
Cheers for the patch.
reason Unauthorized
I tried with another Dropbox acct and got the same issue.
Are you by chance using an App that you created a long time ago? It seems newer Apps use a newer API version:
https://github.com/RISCfuture/dropbox/issues/45
Regards and thanks for your help! Gary
Are you by chance using an App that you created a long time ago? It seems newer Apps use a newer API version:
Yes, that seems to be the problem. Thanks. I probably won't update to the new API for a while. Maybe at the end of the month. I visited the dropbox site and it seems I can configure the account, so that I can use my keys with up to 5 clients. Since I am not overly concerned with security here (the account is for testing anyway), I will send you the keys for using my app, until the problem is resolved.
Much appreciated. My email is the same as my nick here @gmail.com
Hi,
I'm trying to mount my DropBox using your FUSE interface. I created an App key and secret and added them and my username/password to ./config/config. However I see in the pyfusebox.log the following:
2013-01-31 11:50:31,185 - pyfusebox - DEBUG - __get_new_store: 2013-01-31 11:50:31,185 - pyfusebox - DEBUG - get dropbox store 2013-01-31 11:50:31,560 - pyfusebox - DEBUG - Invalid response code 401 2013-01-31 11:50:31,560 - pyfusebox - DEBUG - got dropbox store
Regards, Gary