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

[ecobee] Improve handling of access token expiration #7506

Merged
merged 1 commit into from
Apr 30, 2020

Conversation

mhilbush
Copy link
Contributor

There have been cases where the call to the Ecobee API has resulted in a response indicating that the token has expired. It happens very rarely, typically once every 2-4 weeks. Generally, this should not happen, since the OAuthClientService in OHC uses an expire time buffer (default is 10 seconds) to refresh the token before it expires.

I wanted to change the expire time buffer to a longer amount, but the API currently doesn't support that. See here.

Therefore, in this PR, the binding will check for expiration using a custom expire time buffer (using AccessTokenResponse.isExpired(), then refresh the access token if isExpired() returns true.

Also, the access token expired response from the Ecobee API will be handled less harshly.

Signed-off-by: Mark Hilbush [email protected]

@mhilbush mhilbush added the bug An unexpected problem or unintended behavior of an add-on label Apr 30, 2020
@TravisBuddy
Copy link

Travis tests were successful

Hey @mhilbush,
we found no major flaws with your code. Still you might want to look at this logfile, as we usually suggest some optional improvements.

Copy link
Contributor

@robnielsen robnielsen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@cpmeister cpmeister left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@cpmeister cpmeister merged commit 1443bf3 into openhab:2.5.x Apr 30, 2020
@cpmeister cpmeister added this to the 2.5.5 milestone Apr 30, 2020
@mhilbush mhilbush deleted the ecobee-auth-fix branch April 30, 2020 19:51
LoungeFlyZ pushed a commit to LoungeFlyZ/openhab2-addons that referenced this pull request Jun 8, 2020
J-N-K pushed a commit to J-N-K/openhab-addons that referenced this pull request Jul 14, 2020
CSchlipp pushed a commit to CSchlipp/openhab-addons that referenced this pull request Jul 26, 2020
andrewfg pushed a commit to andrewfg/openhab-addons that referenced this pull request Aug 31, 2020
andrewfg pushed a commit to andrewfg/openhab-addons that referenced this pull request Aug 31, 2020
andrewfg pushed a commit to andrewfg/openhab-addons that referenced this pull request Aug 31, 2020
andrewfg pushed a commit to andrewfg/openhab-addons that referenced this pull request Aug 31, 2020
DaanMeijer pushed a commit to DaanMeijer/openhab-addons that referenced this pull request Sep 1, 2020
markus7017 pushed a commit to markus7017/openhab-addons that referenced this pull request Sep 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An unexpected problem or unintended behavior of an add-on
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants