Skip to content

Commit 03771e8

Browse files
leogdionclaude
andcommitted
feat: enhance CloudKit.js web auth token extraction and update testing status
MAJOR IMPROVEMENTS: - Enhanced postMessage listener with origin verification (icloud.com, apple-cloudkit.com) - Added network request interception (fetch/XHR) as fallback token capture method - Extended timeout from 5s to 10s for token arrival - Added browser debugging helpers (mistKitDebug.*) - Simplified handleAuthentication() removing 160+ lines of non-working detection code IMPLEMENTATION DETAILS: Phase 1: Enhanced postMessage capture - Origin validation for security - Support for multiple token formats (plain string `158__54__...`, object properties) - Global token storage in window.cloudKitWebAuthToken Phase 2: Network interception fallback - Intercepts fetch() and XMLHttpRequest - Captures tokens from CloudKit API responses - Logs all CloudKit requests for debugging Phase 3: Simplified authentication flow - Removed localStorage, cookies, property access strategies (didn't work) - Clean token promise with 10s timeout - Manual extraction instructions on failure Phase 5: Debugging helpers - mistKitDebug.container() - Get CloudKit container - mistKitDebug.token() - Get current token - mistKitDebug.setToken(tok) - Manually set token - mistKitDebug.sendToServer() - Send token to server - mistKitDebug.inspectContainer() - Inspect container for token TESTING STATUS UPDATE: - Web auth token successfully extracted manually (158__54__... format verified) - Implementation complete and ready for testing - Blocked on CloudKit container configuration (421 Misdirected Request) - Need to verify container setup at icloud.developer.apple.com/dashboard FILES MODIFIED: - Examples/MistDemo/Sources/MistDemo/Resources/index.html - Examples/MistDemo/Sources/MistDemo/MistDemo.swift - Examples/MistDemo/TESTING_STATUS.md Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent b03c2e4 commit 03771e8

File tree

4 files changed

+489
-205
lines changed

4 files changed

+489
-205
lines changed

Examples/MistDemo/Sources/MistDemo/MistDemo.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,13 @@ struct MistDemo {
8989
}
9090
return
9191
}
92+
93+
router.middlewares.add(
94+
FileMiddleware(
95+
resourcesPath,
96+
searchForIndexHtml: true
97+
)
98+
)
9299

93100
// Check if a command was specified
94101
if let commandName = parser.parseCommandName() {

0 commit comments

Comments
 (0)