acd_cli icon indicating copy to clipboard operation
acd_cli copied to clipboard

oauth_data token expiration

Open Lazlowk opened this issue 8 years ago • 6 comments

trying to integrate into a headless ubuntu machine that is not running X. running the acd_cli init command nets the proper w3m browser and login, however the json payload is not coming out formatted properly.

It apprears that the pipe is breaking the text in w3m, so after doing some formatting and adding proper quotations and delimiters, I plug it into home/user/.cache/acd_cli/oauth_data and the following error occurs:

16-07-14 19:37:15.609 [CRITICAL] [acdcli.api.client] - Error getting endpoint data. Response: {"message":"Token has expired"} Traceback (most recent call last): File "/usr/local/bin/acd_cli", line 9, in load_entry_point('acdcli==0.3.1', 'console_scripts', 'acd_cli')() File "/usr/local/bin/acd_cli.py", line 1338, in main acd_client = client.ACDClient(CACHE_PATH) File "/usr/local/lib/python3.4/dist-packages/acdcli/api/client.py", line 34, in init self._load_endpoints() File "/usr/local/lib/python3.4/dist-packages/acdcli/api/client.py", line 44, in _load_endpoints self._endpoint_data = self._get_endpoints() File "/usr/local/lib/python3.4/dist-packages/acdcli/api/client.py", line 58, in _get_endpoints raise Exception Exception

The token was generated within 3 minutes of running init.

Lazlowk avatar Jul 14 '16 19:07 Lazlowk

Maybe a Timezone issue ? See https://github.com/ncw/rclone/issues/427

solracsf avatar Sep 11 '16 21:09 solracsf

@Lazlowk Were you ever able to fix this issue? I am running into the same thing in almost the same situation.

jstraw4663 avatar Sep 16 '16 15:09 jstraw4663

@Lazlowk @jstraw4663 were either of you able to get this figured out? I am running into the exact same issue.

tswilson21 avatar Oct 31 '16 19:10 tswilson21

I forget exactly what I did but I either:

  1. Got a new auth token from this link: https://tensile-runway-92512.appspot.com/ Or
  2. Removed the nodes.db file from inside the ~/.cache/acd_cli/ folder and reran 'acd_cli sync'

jstraw4663 avatar Oct 31 '16 19:10 jstraw4663

@jstraw4663 Wow thanks for the fast response. I ended up fixing it before I saw you responded.

What I did was delete the existing oauth_data file, and then re-run acdcli init. Everything is working now.

tswilson21 avatar Oct 31 '16 20:10 tswilson21

Hi All,

I've done some debugging and believe I have found the root cause of the issue. When the application first loads, the oauth_data file is read and the properties OAuthHandler class are set from the json (oauth.py: line 90). The code then checks if the expiry date has been set. This is not part of the json so is not present initially. When the expiry date is not set, it is set the the time when the class was initialised + the "expires_in" time from the json (oauth.py: 96). Given that the token was loaded from file rather than retrieved from amazon, this expiry date is wrong but because of this, the application believes it to be valid and does not obtain a new token.

Edit: My workaroud (I'm automatically deploying so want the oauth_data file be valid every deployment) has been to change the access_token to a blank string and set the expires_in value to 0. Then when acd_cli launches, the first thing it does is refreshes the access_token.

6cUbi57z avatar Feb 01 '17 22:02 6cUbi57z