Skip to content

Report rejected credentials through a callback - #121

Merged
Sholofly merged 1 commit into
devfrom
fix/report-auth-failure
Oct 30, 2026
Merged

Sholofly merged 1 commit into
devfrom
fix/report-auth-failure

Conversation

@Sholofly

Copy link
Copy Markdown
Owner

When the provider revoked the credentials or refresh token while the client was running, the hourly token refresh and the MQTT reconnect loop only logged an error, so the owner never learned that a new login was needed.

LGHorizonAuth now takes an auth_failure_callback that is called when a token request is rejected as unauthorized. It is called once per failure streak and again after a token request has succeeded in between.

LGHorizonApi.set_token_refresh_callback set a token_refresh_callback attribute that LGHorizonAuth did not have, so it had no effect. Add the property. Fix the README example, which passed an async callback that the library calls synchronously, and document both callbacks.

When the provider revoked the credentials or refresh token while the
client was running, the hourly token refresh and the MQTT reconnect loop
only logged an error, so the owner never learned that a new login was
needed.

LGHorizonAuth now takes an auth_failure_callback that is called when a
token request is rejected as unauthorized. It is called once per failure
streak and again after a token request has succeeded in between.

LGHorizonApi.set_token_refresh_callback set a token_refresh_callback
attribute that LGHorizonAuth did not have, so it had no effect. Add the
property. Fix the README example, which passed an async callback that the
library calls synchronously, and document both callbacks.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@Sholofly
Sholofly merged commit bb3c995 into dev Oct 30, 2026
4 checks passed
@Sholofly
Sholofly deleted the fix/report-auth-failure branch October 30, 2026 22:20
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

Successfully merging this pull request may close these issues.

1 participant