fix: auto-refresh token, persist to session, fix Object.keys length b… - #101
fix: auto-refresh token, persist to session, fix Object.keys length b…#101tibrown wants to merge 1 commit into
Conversation
…ug, Heroku/local intervals
|
Thanks for putting this together. The scheduling and fail-safe handling are a clear improvement — on my setup the 24h timer fires on time, and unlike the previous behavior a failed refresh no longer clobbers the working session (I stayed logged in). So the lifecycle wiring works as intended. That said, the scheduled refresh itself isn't obtaining new tokens for me. At the 24h mark: The For contrast, a manual So the failure is specifically in the register / token-exchange path, not cookie serialization. It looks like the scheduled refresh depends on a working device-registration / refresh_token flow that isn't succeeding against Amazon's current backend — possibly tied to that stale device fingerprint. The scheduling/persistence changes here are solid, but at least in my environment they don't restore true token refresh, since the underlying register flow appears broken upstream. Happy to test patches or pull more logs. Environment: local (non-Heroku) mode, built from |
|
One more finding that's directly actionable for this PR. The scheduled refresh you added fails safe — on a failed register it logs the error and leaves the existing session untouched. But the legacy Here's the manual endpoint hitting the failure path: In my case it happened to self-heal — on restart it re-pulled the cookie from Hubitat, that copy was still valid, and it logged back in — but that's a race, not a guarantee. If the "remove all auth data" had taken before the re-fetch, it'd have logged me out and forced a manual re-login. The concern: now that the register/token flow is unreliable, this makes a routine refresh attempt capable of wiping auth. And the Hubitat app calls this same route on its own Happy to test if you push a change to that route. Environment: local (non-Heroku) mode, built from |
Title: fix: Amazon auth token expiry — scheduled refresh, session persistence, and Object.keys bug