cheeky_acd_cli icon indicating copy to clipboard operation
cheeky_acd_cli copied to clipboard

refresh token

Open ebouda33 opened this issue 7 years ago • 11 comments

Sorry, but under mac os i don't arrive to take the refresh token i ve you some solution ?

i ll try the old refresh that begin Atzr but doesn t work.

ebouda33 avatar Jun 06 '17 19:06 ebouda33

Traceback (most recent call last): File "/usr/local/bin/acdcli", line 9, in load_entry_point('acdcli==0.3.2', 'console_scripts', 'acdcli')() File "/usr/local/lib/python3.4/dist-packages/acdcli-0.3.2-py3.4.egg/EGG-INFO/scripts/acd_cli.py", line 1657, in main acd_client = client.ACDClient(CACHE_PATH, SETTINGS_PATH) File "/usr/local/lib/python3.4/dist-packages/acdcli-0.3.2-py3.4.egg/acdcli/api/client.py", line 43, in init self.handler = oauth.create_handler(cache_path) File "/usr/local/lib/python3.4/dist-packages/acdcli-0.3.2-py3.4.egg/acdcli/api/oauth.py", line 25, in create_handler return CheekyOAuthHandler(path) File "/usr/local/lib/python3.4/dist-packages/acdcli-0.3.2-py3.4.egg/acdcli/api/oauth.py", line 45, in init self.load_oauth_data() File "/usr/local/lib/python3.4/dist-packages/acdcli-0.3.2-py3.4.egg/acdcli/api/oauth.py", line 106, in load_oauth_data self.get_auth_token(reload=False) File "/usr/local/lib/python3.4/dist-packages/acdcli-0.3.2-py3.4.egg/acdcli/api/oauth.py", line 124, in get_auth_token self.refresh_auth_token() File "/usr/local/lib/python3.4/dist-packages/acdcli-0.3.2-py3.4.egg/acdcli/api/oauth.py", line 172, in refresh_auth_token 'Error refreshing authentication token: %s' % response.text) acdcli.api.common.RequestError: RequestError: 1004, Error refreshing authentication token: {"error_description":"The request has an invalid parameter : source_token","error":"InvalidValue"}

ebouda33 avatar Jun 06 '17 19:06 ebouda33

how you do it to work?

???!!!!

ebouda33 avatar Jun 06 '17 19:06 ebouda33

You need a token from the Amazon Drive app. The old acd_cli token won't work.

The procedure for obtaining the token on macOS is essentially the same as Windows, but you will need a different tool to dump the memory of the Amazon Drive process. I just tested this with gcore and it worked well.

chrisgavin avatar Jun 06 '17 19:06 chrisgavin

Whats the trick? Even after up- and downloading files to acd with the native windows app the token could not be found in the memory dump.

I got it working with the refresh token generated by another whitelisted acd app, not sure if they will be banned soon as well.

ghost avatar Jun 09 '17 11:06 ghost

@chrisgavin, thanks for putting this together. I'm using the Windows app, and I've synced a folder, and using either HxD or NotePad++ with the hex editor plugin I can't find "Atnr|" anywhere in the dump file. Am I doing something wrong?

realcanadrian avatar Jun 09 '17 15:06 realcanadrian

It worked pretty reliably for me, but maybe it doesn't load the refresh token until it needs to refresh the access token (after an hour at most). Maybe try leaving it running for an hour before doing the memory dump.

The alternative option if the memory dump option is not working is to use Fiddler to intercept the traffic. You just have to enable HTTPS interception and install the certificate, then wait for a request to /auth/token. This will contain your refresh token in a header.

chrisgavin avatar Jun 09 '17 15:06 chrisgavin

Awesome, thanks Chris.

realcanadrian avatar Jun 09 '17 15:06 realcanadrian

Working perfectly using Fiddler method. :)

realcanadrian avatar Jun 09 '17 16:06 realcanadrian

It worked great for me on macOS using gcore as mentioned by @chrisgavin as well as Hex Fiend:

  • find the PID of the Amazon Drive app using Activity Monitor or ps ax | grep "/Amazon Drive.app/Contents/MacOS/Amazon Drive"
  • run sudo gcore -s -v -o amazondrive.dump <PID>
  • open the resulting amazondrive.dump file in Hex Fiend and do a text search for Atnr|
  • copy the found refresh token and paste it into the oauth.json file

blach avatar Jun 10 '17 17:06 blach

It is like chris stated - the app needs to run some hours (or exactly until first refresh was made), until the token is retrieved from amazon.

Thx for the fork!

ghost avatar Jun 11 '17 10:06 ghost

Hi All, Just for reference. I found "refresh token" in request body~~,not in header~

moregatest avatar Jun 13 '17 03:06 moregatest