alex-phillips/node-clouddrive

Authenticating a second time after a token is revoked or expired

jbueler opened this issue · 6 comments

First off thanks for your work on this project!

I am trying to re-authenticate using clouddrive init I get this error message:

Error: Failed to authorize account with Amazon Cloud Drive. Unknown error occurred: {"message":"Token has expired"}

The original auth token has been revoked and I would like to use new auth.id & auth.secret stored in the config.

How can I clear out the current token? Where is the default config file located?

What OS are you running on?

Thanks for the reply,

I am running OS X 10.11.6

Could you run this with the master branch and verbose logging turned on and attach the logs when the error occurs?

Well I have gone in circles on this a little bit. I uninstalled the module npm uninstall -g clouddrive and reinstalled it from GitHub. This allowed me to reauthenticate which is what this ticket was basically trying to accomplish.

I tried to use my own auth.id and auth.secret but there were scope issues and I didn't end up doing that, I just used the default authentication from the documentation. I am still getting an error when trying to upload (the reason this all started in the first place).

This is my current error, I will try to sort this out and go from here:
HTTPError: Response code 409 (Conflict). Reauthenticating and retrying

Thank you so much for your work on this, it makes Amazon Cloud Drive far more useful.

@jbueler If it helps, every time I've seen a 409 conflict error is when my code is attempting to upload a file to a location that already exists. Usually a sync would fix this - perhaps I uploaded a file in another session or on another machine and the machine giving the 409 wasn't aware that that file existed since it wasn't in its local cache.

Let me know if that helps or if you find out anything different.

@jbueler Also, I've seen the conflict code when the upload previously fails due to a connection timeout. Most of the time, the file succeeds in this case, but the server processing the MD5 and storing the file can take some time depending on the size. Therefore, when the code attempts to try again, there is a conflict since the server says it already exists, but it doesn't exist locally in the cache yet.

You can ignore this and running a sync and then attempting to reupload will show that the file completed successfully.