Skip to content

fix: use JSON endpoints for SMS verification - #62

Merged
rileytestut merged 4 commits into
rileytestut:notarizedfrom
kisnner26:fix/sms-json-verification
Nov 7, 2026
Merged

rileytestut merged 4 commits into
rileytestut:notarizedfrom
kisnner26:fix/sms-json-verification

Conversation

@kisnner26

@kisnner26 kisnner26 commented Oct 29, 2026 •

Copy link
Copy Markdown

sms verification in altserver 1.8.2 and altstore classic fails with http 415 in altstoreio/AltStore#1844. the current client posts an xml plist to /auth/verify/phone/put?mode=sms.

this switches sms delivery to PUT /auth/verify/phone with json and code verification to POST /auth/verify/phone/securitycode with nested phoneNumber and securityCode objects. both requests explicitly advertise application/json for content-type and accept. trusted-device requests retain their existing format.

the wire format follows isideload's sms flow and its sms headers.

validation is limited to swift frontend parsing and git diff --check. no real sms delivery, code verification, or apple sign-in has been tested.

draft: no end-to-end apple sms sign-in has been tested. this is a protocol-alignment candidate, not a confirmed resolution of #1844. the existing phone-id-1 selection and PE-token success check are unchanged and also need validation with an affected account. no credentials were used in the checks.

@kisnner26

kisnner26 commented Oct 29, 2026 •

Copy link
Copy Markdown
Author

removed the simulated test harness. the seven scenarios previously reported used a stubbed transport and do not establish compatibility with apple. validation is limited to syntax and diff checks; real sms delivery, code verification, and sign-in remain untested. the full build attempt stopped at the missing OpenSSL.xcframework dependency. this remains a draft candidate, not a confirmed fix.

jaakkopalvaila added a commit to jaakkopalvaila/AltServer-Windows that referenced this pull request Nov 5, 2026
An account with no trusted device gets "au" = "secondaryAuth" from
GrandSlam. AltSign only knew trustedDeviceSecondaryAuth, so it treated
the account as having no 2FA and the sign-in failed later.

secondaryAuth now requests the code by SMS and validates it with the
JSON endpoints that rileytestut/AltSign#62 proposes and isideload uses:
PUT /auth/verify/phone {"phoneNumber":{"id":1},"mode":"sms"}, then
POST /auth/verify/phone/securitycode with the code. Content-Type and
Accept are application/json. Like isideload:

- phone number id 1, the account's first trusted number;
- HTTP 412 with an unlocked challenge, or serviceErrors -22979/-22981,
  means a code was already sent and is still valid, so no new one is
  requested;
- -21669 is an incorrect code;
- any 2xx answer to the code counts as success, and sign-in then runs
  again with fresh anisette data, as for trusted-device codes.

Other serviceErrors are surfaced with Apple's message. The headers
shared with trusted-device 2FA move into TwoFactorHeaders(). The SMS
validation uses refreshed anisette data, since typing the code can
outlast the one-time password.

Not yet tried against Apple.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
jaakkopalvaila added a commit to jaakkopalvaila/AltServer-Windows that referenced this pull request Nov 5, 2026
An account with no trusted device gets "au" = "secondaryAuth" from
GrandSlam. AltSign only knew trustedDeviceSecondaryAuth, so it treated
the account as having no 2FA and the sign-in failed later.

secondaryAuth now requests the code by SMS and validates it with the
JSON endpoints that rileytestut/AltSign#62 proposes and isideload uses:
PUT /auth/verify/phone {"phoneNumber":{"id":1},"mode":"sms"}, then
POST /auth/verify/phone/securitycode with the code. Content-Type and
Accept are application/json. Like isideload:

- phone number id 1, the account's first trusted number;
- HTTP 412 with an unlocked challenge, or serviceErrors -22979/-22981,
  means a code was already sent and is still valid, so no new one is
  requested;
- -21669 is an incorrect code;
- any 2xx answer to the code counts as success, and sign-in then runs
  again with fresh anisette data, as for trusted-device codes.

Other serviceErrors are surfaced with Apple's message. The headers
shared with trusted-device 2FA move into TwoFactorHeaders(). The SMS
validation uses refreshed anisette data, since typing the code can
outlast the one-time password.

Not yet tried against Apple.
jaakkopalvaila added a commit to jaakkopalvaila/AltServer-Linux that referenced this pull request Nov 5, 2026
Bumps upstream_repo to ac02e35 (AltServer-Windows branch sms-2fa):
GrandSlam's "secondaryAuth" now gets an SMS code through the JSON
endpoints from rileytestut/AltSign#62 and isideload, instead of
being mistaken for an account without 2FA. README-NG documents it
as Fix 7, experimental until it has signed in against Apple.

Built for x86_64; not yet tried against Apple.
@jaakkopalvaila

Copy link
Copy Markdown

Data point for these JSON endpoints against Apple, from a C++ port of the same flow in my AltServer-Linux fork (AltSign as vendored in AltServer-Windows, not AltStore itself). Tested 2026-11-05 with a free Apple ID whose 2FA was SMS only (no trusted devices at the time), Mac anisette.

The endpoints work:

  • PUT https://gsa.apple.com/auth/verify/phone with {"phoneNumber":{"id":1},"mode":"sms"} (Content-Type/Accept: application/json): the SMS arrived.
  • POST https://gsa.apple.com/auth/verify/phone/securitycode with {"securityCode":{"code":"123456"},"phoneNumber":{"id":1},"mode":"sms"}: HTTP 200 with an empty JSON body, the code was accepted, the next GSA sign-in returned hsc=200, and the install finished.

Two things that cost me a failed attempt each, in case they matter for this PR:

  1. Keep one anisette identity for the whole sign-in. With an anisette server whose v1 endpoint returns a new device for every request (new.ani.sidestore.io does), the code was accepted for device A, and the second sign-in from device B got au=trustedDeviceSecondaryAuth, hsc=409 again. Fetching anisette once and reusing it (or only accepting a refresh with the same X-Mme-Device-Id) fixed it.
  2. au did not say "SMS" for this account. Apple's sign-in reply said au=trustedDeviceSecondaryAuth, not secondaryAuth, even though the account had no trusted device. So a client that takes the SMS path only on secondaryAuth never gets there. (On the trusted-device path, GET /auth/verify/trusteddevice made Apple send an SMS by itself for this account.) GET https://gsa.apple.com/auth (JSON) returns the account's 2FA info (trustedPhoneNumber, and noTrustedDevices per fastlane/isideload), which is what my fork now uses to choose the path.

C++ implementation, if useful for comparison: https://github.com/jaakkopalvaila/AltServer-Windows/blob/5224db7b0c19015126ff678c88b83a3cbfeecd42/AltSign/AppleAPI%2BAuthentication.cpp (AppleAPI+Authentication.cpp, RequestSMSTwoFactorCode).

@rileytestut
rileytestut marked this pull request as ready for review November 7, 2026 20:06
@rileytestut

Copy link
Copy Markdown
Owner

Thank you so much for this! I've confirmed it works to sign in with my test Apple ID that had this issue, will release an update with this fix soon.

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.

3 participants