Repository navigation
Conversation
…warning Generac's Auth0 tenant gives refresh tokens a ~90-day absolute lifetime (observed in production: invalid_grant exactly 90 days after login while refreshing every 2 h). Refreshing doesn't extend it, so every user had to reauth manually every 90 days. - Opt-in "Remember password" on setup / reauth / reconfigure. When set, an invalid_grant triggers a full login with the stored password; the new refresh token + DPoP key are adopted in place and persisted, so polling continues without a failed update. MFA challenges or a rejected password fall back to the normal reauth flow. Unticking the box removes the stored password. MFA accounts never store it. - Record token_issued_at at every login; when no password is stored, raise a Repairs warning 10 days before the expected expiry. Cleared on the next successful poll after re-signing in. - Correct the auth.py docstring that claimed refresh tokens are reusable indefinitely. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Generac's Auth0 tenant (
auth.ecobee.com) gives this client's refresh tokens an absolute lifetime of ~90 days. Using the token doesn't extend it; only a fresh login does. As a result every user gets dropped into reauth every 90 days, and all entities gounavailableuntil they notice.Observed on a live install. The entry was signed in at
2026-07-29 18:15 UTCand refreshed every 2 h (expires_in=7200) without trouble:The 90-day mark (
2026-10-27 18:15 UTC= 11:15 PDT) falls exactly between the last successful refresh and the first failure. Theauth.pydocstring claiming the token is "reusable indefinitely" was wrong.Fix
invalid_grantis returned,GeneracAuthruns a full login with the stored password. It then switches to the new refresh token and DPoP key in place and saves them toentry.data.InvalidGrantErrorand the normal reauth flow takes over.token_issued_at.WARNINGRepairs issue appears 10 days before the expected expiry, telling the user to Reconfigure.Both values are in
const.py(REFRESH_TOKEN_LIFETIME_DAYS = 90,REFRESH_TOKEN_WARN_DAYS = 10).Tests
pytest: 83 passed on Python 3.14.pre-commit run --all-filesis clean.