blitz-mac icon indicating copy to clipboard operation
blitz-mac copied to clipboard

ASC sign-in never remembers "Trust This Browser" — re-prompts on every single login

Open 24leviii-arch opened this issue 4 months ago • 0 comments

Description

Every time the Apple ID sign-in sheet (AppleIDLoginSheet) opens to refresh the ASC web session, Apple's 2FA flow asks to "Trust This Browser." Checking that box has no effect — the very next sign-in asks again, with no exceptions.

Root cause

ASCWebView.makeNSView configures its WKWebView with an ephemeral data store:

let config = WKWebViewConfiguration()
config.websiteDataStore = .nonPersistent()

.nonPersistent() is an in-memory-only store — everything (cookies, local storage, Apple's own device-trust cookie) is discarded the instant the WebView/sheet is deallocated. Since the WebView has zero memory of any previous session, idmsa.apple.com's identity servers see what looks like a brand-new, never-seen device/browser on every single sign-in and re-run full 2FA + the trust prompt. The checkbox literally cannot work, because there is no persistent storage for the resulting trust token to land in.

Fix

Opened as #26 — swaps .nonPersistent() for WKWebsiteDataStore(forIdentifier:) with a stable UUID, giving the WebView its own persistent-but-isolated (not shared with Safari) data store that survives across app launches. Verified swift build --target Blitz succeeds with the change; the cookie-capture/ASCWebSessionStore logic is untouched.

Impact

Every user hits this on every sign-in — it's not intermittent.

24leviii-arch avatar Jul 24 '26 11:07 24leviii-arch