Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

oauth_data token expiration #358

Open
Lazlowk opened this issue Jul 14, 2016 · 6 comments
Open

oauth_data token expiration #358

Lazlowk opened this issue Jul 14, 2016 · 6 comments

Comments

@Lazlowk
Copy link

Lazlowk commented Jul 14, 2016

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.

@solracsf
Copy link

Maybe a Timezone issue ? See rclone/rclone#427

@jstraw4663
Copy link

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

@tswilson21
Copy link

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

@jstraw4663
Copy link

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'

@tswilson21
Copy link

@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.

@6cUbi57z
Copy link

6cUbi57z commented Feb 1, 2017

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants