Skip to content

[BUG] Wrapper v2 1.0.0: Apple Music build 1109 authentication fails with native response_type=4 (Linux x86_64) #23

Open

Description

@TuPapaPendejo

Summary

Fresh installation/build of Wrapper v2 1.0.0 on Linux x86_64 using the pinned Apple Music 3.6.0-beta build 1109 package consistently fails during native Apple Music authentication.

The worker starts, the Wrapper API is reachable, and the native sign-in dialog and credentials callbacks are handled without a reported callback error. However, Apple's native AuthenticateFlow returns response_type=4, with no error object/code exposed by AR_error. Wrapper then reports authentication_failed and returns HTTP 502 from POST /session/login.

The same failure occurs through Gamdl and through a direct call to Wrapper's login API. A separate TLS trust-store omission affecting curl access to gsa.apple.com was identified and corrected locally; after rebuilding with the corrected CA bundle, TLS validation succeeds but the native authentication failure remains unchanged.

This report is specifically for the new 1.0.0 implementation/API and its isolated native worker, not just the older implementation discussed in issue #3. I am opening a separate report because 1.0.0 is a ground-up rewrite and this appears to be a blocking first-login problem in the new release.

Environment

  • Host OS: openSUSE Tumbleweed x86_64, running under WSL.
  • Container/build platform: linux/amd64.
  • Android worker architecture/profile: x86_64 / apple-music-1109-x86_64.
  • Docker Buildx: 0.38.1.
  • Wrapper: 1.0.0.
  • Wrapper source revision used for the build: 9a6f29f493b1bac5325105ab6edf5dbd8caaae8c.
  • Gamdl: 4.1.1.
  • Apple Music package: 3.6.0-beta, build 1109, APKM bundle.
  • APKM SHA-256: 5be907af370a7f6bd73344e646dcfebe2e64c2da3b9ad71192110c91950f3f67.

The APKM SHA-256 matches the bundle_sha256 value in the apple-music-1109-x86_64 profile. The account can sign in through Apple's official web and native clients. Two-factor authentication is enabled. Credentials and verification codes were entered only locally and are not included here.

Steps to reproduce

  1. Check out the Wrapper v2 source at revision 9a6f29f493b1bac5325105ab6edf5dbd8caaae8c.
  2. Build for x86_64 using the pinned build-1109 package:
    ./tools/build-docker.sh /path/to/AppleMusic-3.6.0-beta-1109.apkm --arch x86_64
  3. Start the Compose service:
    docker compose up -d
  4. Confirm the service responds to GET /health and GET /info.
  5. Run gamdl auth, select Wrapper, and enter the Apple Account credentials interactively.
  6. Authentication fails. Gamdl reports that Apple Music or Wrapper returned an error. Wrapper logs show POST /session/login returning HTTP 502 with authentication_failed.
  7. The same failure was also reproduced by invoking Wrapper's POST /session/login endpoint directly from a standalone Python test, bypassing Gamdl's TUI/client. The Wrapper's native diagnostic was the same.

No credentials, challenge codes, cookies, tokens, or request bodies are attached to this report.

Actual result

The most recent attempt produced these sanitized Wrapper logs (timestamps retained; no account data is present):

{"timestamp":"2026-11-19T23:21:09.836850Z","level":"INFO","event":"server.started","version":"1.0.0","protocol":1,"architecture":"x86_64","host":"0.0.0.0","port":80}
{"timestamp":"2026-11-19T23:25:11.413099Z","level":"INFO","event":"http.request","request_id":1,"method":"GET","path":"/info","status":200,"duration_ms":0}
{"timestamp":"2026-11-19T23:25:12.867526Z","level":"INFO","event":"worker.started","architecture":"x86_64"}
{"timestamp":"2026-11-19T23:25:12.868333Z","level":"INFO","event":"http.request","request_id":2,"method":"GET","path":"/session","status":200,"duration_ms":1449}
{"timestamp":"2026-11-19T23:25:14.324184Z","level":"WARN","event":"worker.error","operation":"session.restore","code":"session_expired","restart_required":false}
{"timestamp":"2026-11-19T23:25:14.324307Z","level":"WARN","event":"http.request","request_id":3,"method":"POST","path":"/session/restore","status":403,"duration_ms":1453,"code":"session_expired"}
{"timestamp":"2026-11-19T23:25:15.588512Z","level":"INFO","event":"http.request","request_id":4,"method":"GET","path":"/info","status":200,"duration_ms":0}
{"timestamp":"2026-11-19T23:25:15.591389Z","level":"INFO","event":"http.request","request_id":5,"method":"GET","path":"/session","status":200,"duration_ms":0}
{"timestamp":"2026-11-19T23:25:23.845087Z","level":"WARN","event":"session.auth_diagnostic","stage":"native_response","callback_failure":"none","response_type":"Some(4)","apple_error_code":"None","credential_callbacks":1,"dialog_callbacks":1,"unmatched_dialogs":0,"hsa2_requested":false,"known_dialog_selected":true}
{"timestamp":"2026-11-19T23:25:23.845472Z","level":"WARN","event":"worker.error","operation":"session.login","code":"authentication_failed"}
{"timestamp":"2026-11-19T23:25:23.851925Z","level":"INFO","event":"worker.stopped"}
{"timestamp":"2026-11-19T23:25:23.851989Z","level":"ERROR","event":"http.request","request_id":6,"method":"POST","path":"/session/login","status":502,"duration_ms":1702,"code":"authentication_failed"}

Interpretation of the diagnostic

  • worker.started confirms the native worker process starts.
  • /info and /session are reachable and return HTTP 200.
  • credential_callbacks=1: the native authentication flow requests credentials once.
  • dialog_callbacks=1, unmatched_dialogs=0, and known_dialog_selected=true: the known “Sign In” dialog is handled and “Use Existing Apple ID” is selected.
  • callback_failure=none: Wrapper did not record a callback-handling failure.
  • hsa2_requested=false: despite the account having 2FA enabled, this native flow did not request an HSA2 verification code.
  • response_type=Some(4): the native flow returns a response object, but its response type is 4.
  • apple_error_code=None: Wrapper did not receive an AR_error object from which to extract a native error code.

There is a cached-session restoration attempt before the fresh login. It returns session_expired (HTTP 403), after which the client proceeds to a new POST /session/login. The fresh login independently fails with response_type=4. Earlier, when the data volume was empty, restoration instead returned no_cached_session (HTTP 404), and the fresh login still failed. Thus, the cached-session state does not appear to account for the authentication failure.

Source-code path inspected

At the tested source revision, native/session.cpp, in Session::login, performs these operations:

  1. Creates and runs AuthenticateFlow.
  2. Obtains AuthenticateFlow_response.
  3. Reads AR_responseType.
  4. Attempts to obtain AR_error and its SEC_errorCode.
  5. Treats the login as failed unless AR_responseType == 6 or if a callback failed.

In this reproduction, a response exists, its type is 4, and the error pointer is null. The code therefore throws authentication_failed. The diagnostic tells us where the failure is detected, but does not reveal why the proprietary Apple flow returned type 4.

Relevant source at the tested revision: native/session.cpp.

Build, image, and native-artifact verification

The image was built with the repository's tools/build-docker.sh helper for linux/amd64. Buildx reported 28/28 steps completed. The original build history reported:

  • VCS repository: https://github.com/glomatico/wrapper-v2.git
  • VCS revision: 9a6f29f493b1bac5325105ab6edf5dbd8caaae8c
  • Platform: linux/amd64
  • Build argument APPLE_APK_SHA256: 5be907af370a7f6bd73344e646dcfebe2e64c2da3b9ad71192110c91950f3f67
  • Build steps: 28/28 completed.

The staged worker-profile.json contains:

{"architecture":"x86_64","context_profile":"apple-music-1109-x86_64","context_supported":true,"profile":"apple-music-1109-x86_64"}

The following staged library SHA-256 values were checked against the pinned profile and matched exactly:

Library SHA-256
libandroidappmusic.so 2fcdf31a0b3f0f8841ef63cf46efffcf9672a2cea0eef5b066c537d43e293083
libCoreADI.so b5b971cea0bbe828bdcfaf219fd91fc1e37cf8daee84001ef917d0b1c2b985ed
libstoreservicescore.so 0ba169fec7b5a0f70113ab01ba6c60b893c36f9aa080797b13d3830dd3784010

The local image ID and container image ID were also compared before the CA-bundle rebuild and were identical. The container's only mount was the named Wrapper data volume at the app's persistent data directory; no host rootfs was mounted over the image's embedded Android rootfs.

No APK/profile digest mismatch, wrong architecture, incomplete build, or stale-image mismatch was found during these checks.

Separate TLS issue discovered and tested

This investigation found a genuine but separate trust-store issue.

Initially, curl to https://gsa.apple.com/ failed from both openSUSE and inside the container with:

curl: (60) SSL certificate problem: self-signed certificate in certificate chain
OpenSSL verify result: 19

Other tested hosts behaved as follows:

Host Initial result TLS verification
idmsa.apple.com HTTP 200 0
gsa.apple.com HTTP 000 / curl 60 19
music.apple.com HTTP 200 0
amp-api.music.apple.com HTTP 404 0

The server-supplied GSA certificate chain was extracted and inspected:

  • Leaf: CN=gsa.apple.com
  • Intermediate: CN=Apple Server Authentication CA
  • Root: Apple Root CA
  • Root SHA-256 fingerprint: B0B1730ECBC7FF4505142C49F1295E6EDA6BCAED7E2C68C5BE91B5A11001F024

A certificate-by-certificate fingerprint comparison confirmed that this Apple Root CA was absent from the staged worker CA bundle. The worker bundle was byte-identical to the Debian container bundle, with SHA-256:

e9c7b63ee2623386e9b0a3ee32f499d01a8ea23dc83b8383ddff9f8e749543b7

Appending the identified root to a temporary copy of the bundle and using that bundle with curl --cacert made GSA TLS verification succeed:

HTTP=404
TLS_VERIFY=0
CURL_EXIT=0

A local-only Dockerfile change was then tested:

  • Added the verified Apple Root CA PEM to a local tools/certs/ directory.
  • Concatenated it with the normal Debian CA bundle during image build.
  • Passed the combined file to tools/prepare_rootfs.py --ca-bundle.
  • Rebuilt the image successfully (again 28/28 steps completed).
  • Recreated the Compose container with docker compose up -d --force-recreate.

After this change, curl using the actual CA bundle staged inside the new image returned:

HTTP=404
IP=17.179.252.2
TLS_VERIFY=0
CURL_EXIT=0

This confirms that the local CA-bundle change corrected the reproducible curl trust error for GSA. It did not fix native Apple Music authentication: the subsequent fresh gamdl auth attempt still returned response_type=4 with the same callback diagnostic. I am not asserting that the CA issue caused the login failure or that the native Apple networking layer uses the exact same CA path as container curl. This is reported separately so it is not mistaken for the root cause.

What has been ruled out vs. what remains unknown

The following have been tested and are unlikely to explain the persistent response_type=4 failure:

  • Gamdl's interactive authentication UI alone: a direct Wrapper API login attempt failed the same way.
  • Incomplete or unsuccessful Docker build: all 28 build steps completed.
  • Wrong Apple Music APKM or wrong pinned libraries: APKM digest and sampled native library hashes match the pinned build-1109 profile.
  • Wrong runtime architecture: both image and worker profile are x86_64.
  • Container running a different/stale image: image and container IDs matched before the CA-bundle rebuild.
  • The missing GSA root as the sole cause: adding the verified root fixed GSA TLS validation for curl, but did not change the native authentication result.

Not yet tested:

  • A different network path or VPN.
  • Another Apple Account.
  • A different Apple Music app build with a compatible Temari/decryption profile.
  • Additional native instrumentation of the proprietary AuthenticateFlow internals.

I have deliberately not changed the account, device identity, native libraries, or authentication code to avoid introducing confounding variables.

Questions for the maintainer

  1. What does AR_responseType == 4 signify for the Apple Music 3.6.0-beta build-1109 AuthenticateFlow response? Is it a documented or known rejection state?
  2. Is there a way to obtain the underlying Apple error/reason when the response object exists but AR_error is null?
  3. Is hsa2_requested=false expected for an Apple Account with 2FA enabled in this build, or does it suggest that the credentials flow is not reaching the expected HSA2 path?
  4. Does Wrapper 1.0.0 require any additional request parameter, initialization step, device/context setting, or native callback handling for build 1109?
  5. Is there a safe, privacy-preserving diagnostic patch that could expose the rejection reason without logging usernames, passwords, 2FA codes, tokens, cookies, account identifiers, or persistent device identity?

Because this affects the first Apple Account login in the newly released 1.0.0 implementation, it would be helpful to triage it separately from the earlier report for the previous implementation.

I can run targeted tests or provide additional sanitized logs if the maintainer can suggest a specific diagnostic. No credentials, 2FA codes, tokens, cookies, account identifiers, or persistent device identifiers are included in this report.

Activity

  1. TuPapaPendejo commented on Nov 20, 2026

    @TuPapaPendejo
    ContributorAuthor

    Follow-up reproduction — clean installation on 2026-11-20

    I am adding a further reproduction after performing a clean installation of openSUSE Tumbleweed and reinstalling the components needed to run Wrapper. For this test, Gamdl was installed on Windows, rather than being installed in the openSUSE environment used for Wrapper.

    The purpose of this follow-up is to document whether the same authentication failure persists after rebuilding the environment from scratch and moving the Gamdl client to Windows.

    Environment and test conditions

    • Test date: 2026-11-20.
    • Wrapper host environment: freshly installed openSUSE Tumbleweed.
    • Wrapper deployment: Docker Compose.
    • Wrapper version reported by the running server: 1.0.0.
    • Native worker architecture reported by Wrapper: x86_64.
    • Gamdl client environment: Windows.
    • Authentication attempts: three consecutive fresh login attempts through Gamdl.
    • Result: all three attempts failed with the same native authentication diagnostic and HTTP 502 response from POST /session/login.

    The supplied log excerpt confirms Wrapper 1.0.0 and the x86_64 worker. It does not include the full GET /info JSON response, the Apple Music APK/APKM filename, its SHA-256 digest, or the Gamdl version used in this particular clean-install run. I therefore do not claim that those artifacts were independently re-verified as part of this additional reproduction.

    Summary of the three attempts

    All three attempts produced the same diagnostic:

    {
      "stage": "native_response",
      "callback_failure": "none",
      "response_type": "Some(4)",
      "apple_error_code": "None",
      "credential_callbacks": 1,
      "dialog_callbacks": 1,
      "unmatched_dialogs": 0,
      "hsa2_requested": false,
      "known_dialog_selected": true
    }
    Attempt Diagnostic timestamp (UTC) Login HTTP result Duration Native result
    1 2026-11-20 16:46:15.251224 502 2,644 ms response_type=4
    2 2026-11-20 16:46:37.469758 502 1,789 ms response_type=4
    3 2026-11-20 16:46:56.433623 502 1,836 ms response_type=4

    The three responses are consistent with the failure already documented in this issue. Changing the client installation to Windows and reinstalling the openSUSE Wrapper environment did not change the observed authentication result.

    Detailed event sequence

    The following sequence is taken from the Docker Compose log. Timestamps are retained as emitted by Wrapper (UTC, indicated by Z).

    Before the first attempt:

    • Wrapper starts as version 1.0.0 on x86_64.
    • The HTTP API responds to GET /info with HTTP 200.
    • The native worker starts and GET /session responds with HTTP 200.
    • A later worker recycle occurs; the replacement worker also starts successfully and GET /session responds with HTTP 200.
    • At 16:45:55, Wrapper starts another worker generation and again responds successfully to GET /session.
    • The subsequent cached-session restoration returns session_expired (HTTP 403).

    Attempt 1 — 16:46:15 UTC:

    • GET /info responds with HTTP 200.
    • GET /session responds with HTTP 200.
    • The native authentication flow produces one credentials callback and one dialog callback.
    • No unmatched dialog is recorded; the known sign-in dialog selection succeeds.
    • No callback failure is reported.
    • HSA2 verification is not requested.
    • The native flow returns response type 4, and no Apple error object/code is exposed.
    • Wrapper reports worker.error with operation session.login and code authentication_failed.
    • The worker stops.
    • POST /session/login returns HTTP 502 after 2,644 ms.

    Attempt 2 — 16:46:37 UTC:

    • Wrapper starts a replacement worker and GET /session responds with HTTP 200.
    • A cached-session restoration is attempted and returns session_expired (HTTP 403).
    • GET /info and GET /session respond with HTTP 200.
    • The native authentication diagnostic is identical to attempt 1.
    • Wrapper reports authentication_failed, stops the worker, and returns HTTP 502 from POST /session/login.
    • The login request duration is 1,789 ms.

    Attempt 3 — 16:46:56 UTC:

    • Wrapper starts another replacement worker and GET /session responds with HTTP 200.
    • Cached-session restoration again returns session_expired (HTTP 403).
    • GET /info and GET /session respond with HTTP 200.
    • The native authentication diagnostic is again identical.
    • Wrapper reports authentication_failed, stops the worker, and returns HTTP 502 from POST /session/login.
    • The login request duration is 1,836 ms.

    A subsequent worker start and successful GET /session response are also present at 16:47:16 UTC.

    Sanitized Docker log excerpt

    No credentials, account identifiers, cookies, tokens, verification codes, request bodies, or device identity values are included in this excerpt.

    wrapper-1  | {"timestamp":"2026-11-20T16:45:55.380028Z","level":"INFO","event":"http.request","request_id":7,"method":"GET","path":"/info","status":200,"duration_ms":0}
    wrapper-1  | {"timestamp":"2026-11-20T16:45:55.385963Z","level":"INFO","event":"worker.stopped"}
    wrapper-1  | {"timestamp":"2026-11-20T16:45:55.893087Z","level":"INFO","event":"worker.started","architecture":"x86_64"}
    wrapper-1  | {"timestamp":"2026-11-20T16:45:55.893314Z","level":"INFO","event":"http.request","request_id":8,"method":"GET","path":"/session","status":200,"duration_ms":507}
    wrapper-1  | {"timestamp":"2026-11-20T16:45:55.902532Z","level":"WARN","event":"worker.error","operation":"session.restore","code":"session_expired","restart_required":false}
    wrapper-1  | {"timestamp":"2026-11-20T16:45:55.902594Z","level":"WARN","event":"http.request","request_id":9,"method":"POST","path":"/session/restore","status":403,"duration_ms":2,"code":"session_expired"}
    wrapper-1  | {"timestamp":"2026-11-20T16:46:00.293376Z","level":"INFO","event":"http.request","request_id":10,"method":"GET","path":"/info","status":200,"duration_ms":0}
    wrapper-1  | {"timestamp":"2026-11-20T16:46:00.299437Z","level":"INFO","event":"http.request","request_id":11,"method":"GET","path":"/session","status":200,"duration_ms":0}
    wrapper-1  | {"timestamp":"2026-11-20T16:46:15.251164Z","level":"WARN","event":"session.auth_diagnostic","stage":"native_response","callback_failure":"none","response_type":"Some(4)","apple_error_code":"None","credential_callbacks":1,"dialog_callbacks":1,"unmatched_dialogs":0,"hsa2_requested":false,"known_dialog_selected":true}
    wrapper-1  | {"timestamp":"2026-11-20T16:46:15.251224Z","level":"WARN","event":"worker.error","operation":"session.login","code":"authentication_failed"}
    wrapper-1  | {"timestamp":"2026-11-20T16:46:15.258987Z","level":"INFO","event":"worker.stopped"}
    wrapper-1  | {"timestamp":"2026-11-20T16:46:15.259077Z","level":"ERROR","event":"http.request","request_id":12,"method":"POST","path":"/session/login","status":502,"duration_ms":2644,"code":"authentication_failed"}
    wrapper-1  | {"timestamp":"2026-11-20T16:46:20.499258Z","level":"INFO","event":"http.request","request_id":13,"method":"GET","path":"/info","status":200,"duration_ms":0}
    wrapper-1  | {"timestamp":"2026-11-20T16:46:21.025808Z","level":"INFO","event":"worker.started","architecture":"x86_64"}
    wrapper-1  | {"timestamp":"2026-11-20T16:46:21.026055Z","level":"INFO","event":"http.request","request_id":14,"method":"GET","path":"/session","status":200,"duration_ms":520}
    wrapper-1  | {"timestamp":"2026-11-20T16:46:22.413835Z","level":"WARN","event":"worker.error","operation":"session.restore","code":"session_expired","restart_required":false}
    wrapper-1  | {"timestamp":"2026-11-20T16:46:22.413945Z","level":"WARN","event":"http.request","request_id":15,"method":"POST","path":"/session/restore","status":403,"duration_ms":1382,"code":"session_expired"}
    wrapper-1  | {"timestamp":"2026-11-20T16:46:24.259524Z","level":"INFO","event":"http.request","request_id":16,"method":"GET","path":"/info","status":200,"duration_ms":0}
    wrapper-1  | {"timestamp":"2026-11-20T16:46:24.264277Z","level":"INFO","event":"http.request","request_id":17,"method":"GET","path":"/session","status":200,"duration_ms":0}
    wrapper-1  | {"timestamp":"2026-11-20T16:46:37.469702Z","level":"WARN","event":"session.auth_diagnostic","stage":"native_response","callback_failure":"none","response_type":"Some(4)","apple_error_code":"None","credential_callbacks":1,"dialog_callbacks":1,"unmatched_dialogs":0,"hsa2_requested":false,"known_dialog_selected":true}
    wrapper-1  | {"timestamp":"2026-11-20T16:46:37.469758Z","level":"WARN","event":"worker.error","operation":"session.login","code":"authentication_failed"}
    wrapper-1  | {"timestamp":"2026-11-20T16:46:37.474687Z","level":"INFO","event":"worker.stopped"}
    wrapper-1  | {"timestamp":"2026-11-20T16:46:37.474760Z","level":"ERROR","event":"http.request","request_id":18,"method":"POST","path":"/session/login","status":502,"duration_ms":1789,"code":"authentication_failed"}
    wrapper-1  | {"timestamp":"2026-11-20T16:46:40.978314Z","level":"INFO","event":"http.request","request_id":19,"method":"GET","path":"/info","status":200,"duration_ms":0}
    wrapper-1  | {"timestamp":"2026-11-20T16:46:41.504651Z","level":"INFO","event":"worker.started","architecture":"x86_64"}
    wrapper-1  | {"timestamp":"2026-11-20T16:46:41.504956Z","level":"INFO","event":"http.request","request_id":20,"method":"GET","path":"/session","status":200,"duration_ms":520}
    wrapper-1  | {"timestamp":"2026-11-20T16:46:42.709244Z","level":"WARN","event":"worker.error","operation":"session.restore","code":"session_expired","restart_required":false}
    wrapper-1  | {"timestamp":"2026-11-20T16:46:42.709336Z","level":"WARN","event":"http.request","request_id":21,"method":"POST","path":"/session/restore","status":403,"duration_ms":1198,"code":"session_expired"}
    wrapper-1  | {"timestamp":"2026-11-20T16:46:43.398363Z","level":"INFO","event":"http.request","request_id":22,"method":"GET","path":"/info","status":200,"duration_ms":0}
    wrapper-1  | {"timestamp":"2026-11-20T16:46:43.405288Z","level":"INFO","event":"http.request","request_id":23,"method":"GET","path":"/session","status":200,"duration_ms":0}
    wrapper-1  | {"timestamp":"2026-11-20T16:46:56.433567Z","level":"WARN","event":"session.auth_diagnostic","stage":"native_response","callback_failure":"none","response_type":"Some(4)","apple_error_code":"None","credential_callbacks":1,"dialog_callbacks":1,"unmatched_dialogs":0,"hsa2_requested":false,"known_dialog_selected":true}
    wrapper-1  | {"timestamp":"2026-11-20T16:46:56.433623Z","level":"WARN","event":"worker.error","operation":"session.login","code":"authentication_failed"}
    wrapper-1  | {"timestamp":"2026-11-20T16:46:56.442198Z","level":"INFO","event":"worker.stopped"}
    wrapper-1  | {"timestamp":"2026-11-20T16:46:56.442356Z","level":"ERROR","event":"http.request","request_id":24,"method":"POST","path":"/session/login","status":502,"duration_ms":1836,"code":"authentication_failed"}
    wrapper-1  | {"timestamp":"2026-11-20T16:47:16.713728Z","level":"INFO","event":"worker.started","architecture":"x86_64"}
    wrapper-1  | {"timestamp":"2026-11-20T16:47:16.714040Z","level":"INFO","event":"http.request","request_id":25,"method":"GET","path":"/session","status":200,"duration_ms":513}
    

    Interpretation and relevance to the existing report

    This clean-install reproduction confirms the following observations:

    1. The problem persists after a clean installation. Reinstalling openSUSE Tumbleweed and the Wrapper dependencies did not remove the failure.
    2. The client environment changed. Gamdl is now installed on Windows, while Wrapper runs in the freshly installed openSUSE/Docker environment. The same result is observed.
    3. The HTTP service and worker startup remain operational. /info and /session return HTTP 200, and the x86_64 worker starts successfully.
    4. The failure remains inside the native authentication flow. Every login attempt reaches stage=native_response, with response_type=4 and no exposed Apple error code.
    5. The dialog and credential callbacks still do not report a local handling failure. Each attempt records one credentials callback, one dialog callback, zero unmatched dialogs, known_dialog_selected=true, and callback_failure=none.
    6. No HSA2 challenge is requested in any of these attempts. The diagnostic repeatedly reports hsa2_requested=false.
    7. The session restoration errors are separate from the fresh-login result. session.restore returns session_expired before each fresh login, but the fresh login independently reaches the same response_type=4 failure. The cached-session restoration result therefore does not explain the repeated native response.
    8. The worker is recycled after each failed login. A new worker starts before the subsequent attempt; this does not change the native authentication result.

    The source-code behavior remains relevant: in native/session.cpp, Session::login() treats every response type other than 6 as an authentication failure. The observed response type 4 therefore explains Wrapper's authentication_failed result, but it does not establish why Apple's native AuthenticateFlow returned 4.

    What this additional test does and does not establish

    It establishes:

    • The issue is reproducible on 2026-11-20 after a clean openSUSE Tumbleweed installation.
    • The failure persists with Gamdl installed on Windows.
    • Three consecutive attempts produce the same native diagnostic.
    • The failure is not explained by a failure to reach Wrapper's HTTP API or start the native worker.

    It does not establish:

    • The exact semantic meaning of Apple's response_type=4.
    • Whether Apple is rejecting the account, credentials, device identity, network path, or some aspect of the build-1109 authentication flow.
    • Whether the current run used an APK/APKM whose digest was independently checked in this test; the supplied excerpt does not contain that verification.
    • Whether a different network path or VPN changes the result.

    Additional questions for investigation

    1. Can the maintainer identify the meaning of AuthenticateResponse::responseType() == 4 for the pinned Apple Music build?
    2. Can AuthenticateResponse::customerMessage() provide a safe diagnostic when AR_error is null? This method is declared in native/symbols.hpp, but is not currently used by Session::login().
    3. Is hsa2_requested=false expected for an account with two-factor authentication enabled in this authentication flow?
    4. Is there any missing initialization, device/context setting, callback handling, or build-1109 compatibility issue that could explain this response?
    5. Is there a recommended privacy-preserving instrumentation patch to expose more of the native failure reason without logging credentials, verification codes, tokens, cookies, account identifiers, or persistent device identity?

    This is an additional reproduction of the existing 1.0.0 issue, not a separate issue. I am keeping the original report intact and adding this clean-install result to its timeline.

    No credentials, verification codes, cookies, tokens, account identifiers, or persistent device identity are disclosed in this follow-up.

  2. bluhtsturm commented on Nov 21, 2026

    @bluhtsturm

    Same Issue here:

    Login always fails with response_type 4, no 2FA prompt

    Environment

    • wrapper-v2 1.0.0 (x86_64), Docker Compose on Fedora
    • Apple Music APK 3.6.0-beta (build 1109), verified by build script
    • Gamdl 4.1.1
    • Trusted device: iPhone on iOS 26 (no "Get Verification Code" option anymore)

    Problem
    Every login attempt (via gamdl and directly via POST /session/login) fails with
    authentication_failed. Apple never sends a 2FA prompt to my trusted devices.

    {"event":"session.auth_diagnostic","stage":"native_response","callback_failure":"none","response_type":"Some(4)","apple_error_code":"None","credential_callbacks":1,"dialog_callbacks":1,"unmatched_dialogs":0,"hsa2_requested":false,"known_dialog_selected":true}

    What I ruled out

    • Account: password is correct, sign-in on account.apple.com works (with 2FA), account not locked, no security keys, active Apple Music subscription
    • Device identity: deleted the data volume and let wrapper generate a fresh identity, waited 1h before retrying: same result
    • Password + appended 6-digit code (legacy method): same result
    • DNS: outbound DNS to 1.1.1.1/8.8.8.8 is blocked in my network. Before setting WRAPPER_DNS to my local resolver, each attempt took ~5 s and apple_error_code contained random values (632694824, -1134155736), which looks like uninitialized memory. After the DNS fix, attempts return in ~0.5–1.3 s with apple_error_code: None, but still response_type 4.

    Side notes

    • The random apple_error_code values on network failure might be worth looking into.
    • It might help if the docs mentioned that WRAPPER_DNS must be reachable, since a blocked resolver produces the same authentication_failed without any hint.
  3. rocketguedes commented on Nov 25, 2026

    @rocketguedes
  4. rocketguedes commented on Nov 25, 2026

    @rocketguedes

    I hit the exact same issue on a fresh install of Wrapper v2 1.0.0 (linux/amd64, apple-music-1109-x86_64, Gamdl 4.1.1): every login attempt (both through gamdl auth and direct POST /session/login) failed with HTTP 502 and the exact same diagnostic (response_type="Some(4)", apple_error_code="None", hsa2_requested=false, known_dialog_selected=true).

    Workaround that fixed it immediately

    Overriding WRAPPER_DEVICE_INFO in .env to match WorldObservationLog/wrapper's format (16-char 64-bit hex Android ID + newer client/model prefix) and recreating the volume made login succeed on the first attempt (POST /session/login -> 202 2FA prompt -> POST /session/challenge -> 200 session.authenticated):

    WRAPPER_DEVICE_INFO=Music/5.0.2/Android/10/Pixel 8/7663314/en-US/en-US/$(openssl rand -hex 8)
    docker compose down -v
    docker compose up -d

    Same Docker image, same network/DNS, same Apple Account and credentials — only WRAPPER_DEVICE_INFO changed.

    Likely root cause in src/device_info.rs

    Two things differ from the auto-generated default in src/device_info.rs:

    1. random_suffix() reads 16 random bytes and formats a 32-character hex suffix, whereas Android's ANDROID_ID (and WorldObservationLog/wrapper) uses a 16-character hex (64-bit) ID.
    2. DEVICE_PREFIX is still Music/4.9/Android/10/Samsung S9/7663313/en-US/en-US/ instead of a newer version/model (Music/5.0.2/Android/10/Pixel 8/7663314/en-US/en-US/).

    I did not isolate which of the two (32-char vs 16-char ID, or Music/4.9 vs Music/5.0.2) Apple is rejecting, since I kept the working session once authenticated, but updating src/device_info.rs looks like the right place to investigate.

  5. TuPapaPendejo commented on Nov 26, 2026

    @TuPapaPendejo
    ContributorAuthor

    Resolution confirmed — clean x86_64 installation and end-to-end test

    The device-identity compatibility correction described in this issue has now been confirmed in a separate clean installation. I am posting the detailed reproduction and implementation notes here so that the issue records both the original failure and the verified result.

    First, credit for the decisive diagnostic lead belongs to @rocketguedes, specifically comment 7162866962. That comment identified the two differences in the auto-generated WRAPPER_DEVICE_INFO value and reported an immediate successful login after using the newer client fingerprint and a 16-character Android ID. The implementation and follow-up verification below build on that lead.

    1. Root cause indication

    The failing 1.0.0 default in src/device_info.rs generated:

    Music/4.9/Android/10/Samsung S9/7663313/en-US/en-US/<32 hexadecimal characters>
    

    The working override reported by @rocketguedes was:

    Music/5.0.2/Android/10/Pixel 8/7663314/en-US/en-US/<16 lowercase hexadecimal characters>
    

    The differences were:

    Field Original generated value Working value from the report
    Client version Music/4.9 Music/5.0.2
    Device model Samsung S9 Pixel 8
    Client build 7663313 7663314
    Android ID representation 16 random bytes / 128 bits / 32 hex chars 8 random bytes / 64 bits / 16 hex chars

    The original issue's native diagnostic was response_type=Some(4), apple_error_code=None, with successful credential/dialog callbacks and no HSA2 challenge. The new test demonstrates that the combined corrected fingerprint works. It still does not isolate whether Apple rejected the previous client tuple, the suffix length, or the combination of both.

    2. Source correction

    The fix changes the generated default in src/device_info.rs to the complete fingerprint that was reported to work:

    const DEVICE_PREFIX: &str =
        "Music/5.0.2/Android/10/Pixel 8/7663314/en-US/en-US/";

    The Android ID is now generated from eight bytes obtained from /dev/urandom and encoded as 16 lowercase hexadecimal characters. This is the 64-bit representation expected by the reported client fingerprint.

    The implementation deliberately retains 128 bits of randomness for temporary identity-file names. The 64-bit format change applies only to the Android ID field, not to temporary-file entropy.

    The correction also preserves compatibility:

    • An existing .wrapper-device-info is read and reused without rewriting it.
    • Existing 32-character suffixes are not silently converted.
    • The native .worker-device hash is not rewritten.
    • Cached Apple Music session data is not deleted or migrated.
    • Explicit WRAPPER_DEVICE_INFO overrides remain available.
    • New identities continue to be atomically persisted with restrictive file permissions.

    Two Rust regression tests were added: one checks the fresh identity prefix and 16-character lowercase hexadecimal ID; the other ensures an existing 1.0.0 identity remains byte-for-byte unchanged.

    3. Independent clean-install reproduction

    A clean installation was then carried out on:

    • Windows host: Windows 10 IoT Enterprise LTSC 2021.
    • Linux environment: openSUSE Tumbleweed running under an updated WSL installation.
    • Wrapper: 1.0.0, started through Docker Compose inside Linux.
    • Native architecture: x86_64.
    • Apple Music package: 3.6.0-beta, build 1109.
    • Gamdl: clean installation on Windows, separate from the Linux Wrapper deployment.

    This was not a reuse of the earlier failed container installation. Wrapper was set up in the clean Linux environment, and Gamdl was installed separately on Windows.

    4. Successful authentication and 2FA evidence

    The sanitized Docker log shows the following sequence (timestamps are UTC):

    {"timestamp":"2026-11-26T01:52:54.580290Z","level":"INFO","event":"server.started","version":"1.0.0","protocol":1,"architecture":"x86_64","host":"0.0.0.0","port":80}
    {"timestamp":"2026-11-26T01:53:31.644440Z","level":"INFO","event":"http.request","request_id":2,"method":"GET","path":"/session","status":200,"duration_ms":1013}
    {"timestamp":"2026-11-26T01:58:32.479258Z","level":"WARN","event":"worker.error","operation":"session.restore","code":"session_expired","restart_required":false}
    {"timestamp":"2026-11-26T01:58:32.479323Z","level":"WARN","event":"http.request","request_id":6,"method":"POST","path":"/session/restore","status":403,"duration_ms":1,"code":"session_expired"}
    {"timestamp":"2026-11-26T01:58:46.069488Z","level":"INFO","event":"http.request","request_id":9,"method":"POST","path":"/session/login","status":202,"duration_ms":6311}
    {"timestamp":"2026-11-26T01:59:10.838309Z","level":"INFO","event":"session.authenticated"}
    {"timestamp":"2026-11-26T01:59:10.838357Z","level":"INFO","event":"http.request","request_id":10,"method":"POST","path":"/session/challenge","status":200,"duration_ms":4444}
    {"timestamp":"2026-11-26T01:59:10.853881Z","level":"INFO","event":"http.request","request_id":12,"method":"GET","path":"/session/credentials","status":200,"duration_ms":0}

    Interpretation:

    • The HTTP server and x86_64 native worker both started.
    • The restore request returned session_expired (HTTP 403) before the fresh login. This was not the final authentication result and did not prevent a new login.
    • POST /session/login returned HTTP 202, meaning the login was waiting for the 2FA challenge.
    • The challenge submission completed with HTTP 200 and the worker emitted session.authenticated.
    • Session state and credentials retrieval then returned HTTP 200.

    5. Session recovery, playback, and key/context evidence

    The same installation subsequently exercised worker replacement and protected operations:

    {"timestamp":"2026-11-26T02:14:39.596825Z","level":"INFO","event":"worker.started","architecture":"x86_64"}
    {"timestamp":"2026-11-26T02:14:43.461339Z","level":"INFO","event":"session.recovered"}
    {"timestamp":"2026-11-26T02:14:43.461481Z","level":"INFO","event":"http.request","request_id":17,"method":"GET","path":"/session","status":200,"duration_ms":4540}
    {"timestamp":"2026-11-26T02:14:43.471588Z","level":"INFO","event":"http.request","request_id":18,"method":"GET","path":"/session/credentials","status":200,"duration_ms":0}
    {"timestamp":"2026-11-26T02:14:45.062051Z","level":"INFO","event":"http.request","request_id":19,"method":"GET","path":"/playback","status":200,"duration_ms":356}
    {"timestamp":"2026-11-26T02:14:45.388081Z","level":"INFO","event":"http.request","request_id":20,"method":"GET","path":"/playback","status":200,"duration_ms":317}
    {"timestamp":"2026-11-26T02:14:47.230518Z","level":"INFO","event":"http.request","request_id":21,"method":"GET","path":"/key","status":200,"duration_ms":321}
    {"timestamp":"2026-11-26T02:14:47.609184Z","level":"INFO","event":"http.request","request_id":22,"method":"GET","path":"/key","status":200,"duration_ms":309}

    This confirms that the exercised x86_64 flow did not stop at authentication: Wrapper restored the authenticated session after worker replacement, returned playback data twice, and returned successful responses from /key twice.

    The evidence is limited to the tested account, environment, build, architecture, and requests. It is not a claim that every media item, codec, catalog path, or context payload has been independently tested.

    6. ARM64 status

    The corrected fingerprint generation is in the shared Rust device_info.rs module, so the identity correction is expected to apply to ARM64 as well. However, this clean reproduction used only x86_64. No ARM64 build, Apple login, 2FA, session recovery, playback, or context-capture run is claimed here. ARM64 should remain a follow-up verification item.

    7. Patch and documentation

    The changes are available in the fork branch:

    The change is being proposed upstream for review so the default generated device identity can be corrected for future clean installations.

    No Apple Account username, password, 2FA code, cookies, token values, signed playback URLs, or account identifiers are included in this report.

    Upstream pull request submitted

    The proposed source correction and the detailed reproduction have now been submitted to the original project for maintainer review:

    PR #24 is open and ready for review. It includes the source correction, regression coverage, README/installation updates, the sanitized x86_64 reproduction, and the explicit ARM64 verification limitation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions