acd_cli
acd_cli copied to clipboard
oauth_data token expiration
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.
Maybe a Timezone issue ? See https://github.com/ncw/rclone/issues/427
@Lazlowk Were you ever able to fix this issue? I am running into the same thing in almost the same situation.
@Lazlowk @jstraw4663 were either of you able to get this figured out? I am running into the exact same issue.
I forget exactly what I did but I either:
- Got a new auth token from this link: https://tensile-runway-92512.appspot.com/ Or
- Removed the nodes.db file from inside the ~/.cache/acd_cli/ folder and reran 'acd_cli sync'
@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.
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.