Repository navigation
fix: load the mobile sign-in page before posting credentials - #479
Merged
Merged
Conversation
Since the April rewrite the mobile flow posted the credentials straight to /mobile/api/login. Garmin answers such a POST with 429 even when the IP is not rate limited: tested with a made-up account, the direct POST got 429, while loading /mobile/sso/en_US/sign-in first (which sets SESSION, __cf_bm and __cflb) and posting with its Referer got INVALID_USERNAME_PASSWORD, i.e. a processed request. The mobile flow loads the sign-in page again, as the iOS app's web view does, waits 2-5 s, and posts with Referer and Accept-Language. A block on the page load (427/429, or a 403 challenge) stops before any credentials are sent.
Contributor
|
Note Currently processing new changes in this PR. This may take a few minutes, please wait... ⚙️ Run configuration
📒 Files selected for processing: 5
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This was referenced Oct 30, 2026
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.
Builds on #478, which keeps the tests offline.
The mobile login strategies have answered 429 on every attempt, and it isn't a rate limit. Since the April rewrite (5-strategy chain),
_do_mobile_loginposts the credentials straight to/mobile/api/loginwithout first loading the sign-in page. The original implementation, and the iOS app's web view, load/mobile/sso/en_US/sign-infirst.Tested live in the same minute, with the same fingerprint (
safari_ios) and a made-up account:SESSION,__cf_bm,__cflb, …INVALID_USERNAME_PASSWORD, i.e. the request was processedChange
_do_mobile_loginloads the sign-in page first, waits 2–5 s (MOBILE_DELAY_MIN_S/MAX_S), then posts withRefererandAccept-Language.Tests
tests/test_mobile_login.py: the page load happens before the POST, the POST carries the Referer and Accept-Language, and a blocked or challenged page load sends nothing. All 4 fail without the change.get().