Commit 03771e8
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- Examples/MistDemo
- Sources/MistDemo
- Resources
4 files changed
+489
-205
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
89 | 89 | | |
90 | 90 | | |
91 | 91 | | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
92 | 99 | | |
93 | 100 | | |
94 | 101 | | |
| |||
0 commit comments