{"action":"opened","issue":{"url":"https://api.github.com/repos/google/oauth2client/issues/689","repository_url":"https://api.github.com/repos/google/oauth2client","labels_url":"https://api.github.com/repos/google/oauth2client/issues/689/labels{/name}","comments_url":"https://api.github.com/repos/google/oauth2client/issues/689/comments","events_url":"https://api.github.com/repos/google/oauth2client/issues/689/events","html_url":"https://github.com/google/oauth2client/issues/689","id":197766822,"number":689,"title":"Inconsistent definitions of \"expired\" between `access_token_expired()` and `_expires_in()`","user":{"login":"tamakisquare","id":538353,"avatar_url":"https://avatars.githubusercontent.com/u/538353?v=3","gravatar_id":"","url":"https://api.github.com/users/tamakisquare","html_url":"https://github.com/tamakisquare","followers_url":"https://api.github.com/users/tamakisquare/followers","following_url":"https://api.github.com/users/tamakisquare/following{/other_user}","gists_url":"https://api.github.com/users/tamakisquare/gists{/gist_id}","starred_url":"https://api.github.com/users/tamakisquare/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tamakisquare/subscriptions","organizations_url":"https://api.github.com/users/tamakisquare/orgs","repos_url":"https://api.github.com/users/tamakisquare/repos","events_url":"https://api.github.com/users/tamakisquare/events{/privacy}","received_events_url":"https://api.github.com/users/tamakisquare/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-12-27T22:34:07Z","updated_at":"2016-12-27T22:34:07Z","closed_at":null,"body":"I am using a higher-level library, *Pyrebase*, that relies on oauth2client. I have been getting intermittent problem with `OAuth2Credentials.get_access_token()`, in which the token is expired, according to `OAuth2Credentials._expired_in()` that returns an integer `0`, but `OAuth2Credentials.access_token_expired()` thinks otherwise.\r\n\r\nI put in additional logging into the code to see what's going on. I have found out that the intermittent problem that I am getting happens when the expiry time is less than a second away. Here is an example. \r\n\r\n> Now: 2016-12-27 21:55:00.024112, token_expiry: 2016-12-27 21:55:00.204173\r\n\r\n`_expired_in()` would return an integer `0`, indicating that the token has expired, while `access_token_expired()` would return `False` denoting the token is still valid.  The root cause of the problem lies in the fact that the former method has a precision to the nearest second while the latter deals with fraction of a second.\r\n\r\n`access_token_expired()` and `_expires_in()` need to have their definitions of **\"expired\"** aligned with each other."}}
{"actor":{"display_login":"tamakisquare"}}