Skip to content

Commit 591b178

Browse files
rootclaude
andcommitted
fix: handle Apple's new trustedPhoneNumbers location in auth response
Apple moved trustedPhoneNumbers from twoSV.phoneNumberVerification to twoSV.bridgeInitiateData.phoneNumberVerification in their auth page HTML (observed with iOS 26.4+). This caused get_trusted_phone_numbers() to return an empty list, hiding the SMS 2FA option and leaving users with no way to authenticate (since iOS 26 also removed the manual "Get Verification Code" button from Settings). The fix checks both locations, falling back to bridgeInitiateData when the original path returns no results. Fixes #1322 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 3a97872 commit 591b178

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

src/pyicloud_ipd/sms.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,17 @@ def parse_trusted_phone_numbers_payload(content: str) -> Sequence[TrustedDevice]
6565
parser = _SMSParser()
6666
parser.feed(content)
6767
parser.close()
68+
twoSV = parser.sms_data.get("direct", {}).get("twoSV", {})
69+
# Apple moved trustedPhoneNumbers into bridgeInitiateData.phoneNumberVerification (2026+)
6870
numbers: Sequence[Mapping[str, Any]] = (
69-
parser.sms_data.get("direct", {})
70-
.get("twoSV", {})
71-
.get("phoneNumberVerification", {})
72-
.get("trustedPhoneNumbers", [])
71+
twoSV.get("phoneNumberVerification", {}).get("trustedPhoneNumbers", [])
7372
)
73+
if not numbers:
74+
numbers = (
75+
twoSV.get("bridgeInitiateData", {})
76+
.get("phoneNumberVerification", {})
77+
.get("trustedPhoneNumbers", [])
78+
)
7479
return list(item for item in map(_map_to_trusted_device, numbers) if item is not None)
7580

7681

0 commit comments

Comments
 (0)