Skip to content

huawei-push-kit: use expires_in from responses - #1812

Merged
pjfanning merged 2 commits into
apache:mainfrom
pjfanning:huawei
Aug 10, 2026
Merged

huawei-push-kit: use expires_in from responses#1812
pjfanning merged 2 commits into
apache:mainfrom
pjfanning:huawei

Conversation

@pjfanning

Copy link
Copy Markdown
Member
  1. The old behavior was a bug, not a feature — hardcoding 3600s when the server explicitly tells you otherwise is incorrect per OAuth2 spec. A config to "revert to wrong" is unusual.
  2. If the server returns bad data, that's a different problem — and the right fix for that would be validation/fallback logic (e.g., clamp to a reasonable range), not a toggle to ignore the server entirely.
  3. Config surface area — every config option is a maintenance and documentation burden. This one would be hard to name clearly and would confuse users.

What might make more sense as a safety net is a buffer — subtract a small amount (e.g., 60s) from expires_in to account for clock skew and network latency, which is a common pattern:

expiresAt = now + result.expires_in - 60

This protects against edge cases without adding config.

@pjfanning
pjfanning merged commit f37586c into apache:main Aug 10, 2026
53 checks passed
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.

2 participants