Repository navigation
fix(longbridge): send expired_at and fail-closed on refresh errors - #653
Merged
Merged
Conversation
Legacy /v1/token/refresh requires expired_at; omit it and soft-return the stale token let pre-expiry failures sit silent until 401003. Include the query in the HMAC params slot, default new-token lifetime to 90 days, and raise on any non-zero refresh response while the token is still valid.
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.
Summary
refresh_token_if_needednow sends vendor-requiredexpired_at(default +90d, RFC3339Z) onGET /v1/token/refresh, and includes that query string in the HMACparamsslot.Why
LongBridgePlatform path A: pre-expiry Legacy refresh must be reliable before a scheduled refresh job. Soft-fail + missing
expired_athistorically allowed tokens to rot until portal reset (HK incident).Test plan
PYTHONPATH=src python3 -m unittest tests.test_longbridge_auth -v(7 OK)Refs: https://open.longportapp.com/docs/refresh-token-api.md · LongBridgePlatform #585 runbook