Commit ecc682c
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 5b5b639 commit ecc682c
4 files changed
Lines changed: 531 additions & 255 deletions
File tree
- Examples/MistDemo
- Sources/MistDemo
- Resources
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
190 | 190 | | |
191 | 191 | | |
192 | 192 | | |
193 | | - | |
194 | | - | |
195 | | - | |
196 | | - | |
197 | | - | |
198 | | - | |
199 | | - | |
200 | | - | |
201 | | - | |
202 | | - | |
203 | | - | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
204 | 210 | | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
205 | 218 | | |
206 | 219 | | |
207 | 220 | | |
| |||
400 | 413 | | |
401 | 414 | | |
402 | 415 | | |
403 | | - | |
404 | | - | |
405 | | - | |
406 | | - | |
407 | | - | |
408 | | - | |
409 | | - | |
410 | | - | |
411 | | - | |
412 | | - | |
413 | | - | |
414 | | - | |
415 | | - | |
416 | | - | |
417 | | - | |
418 | | - | |
419 | | - | |
420 | | - | |
421 | | - | |
422 | | - | |
423 | | - | |
424 | | - | |
425 | | - | |
426 | | - | |
427 | | - | |
428 | | - | |
429 | | - | |
430 | | - | |
431 | | - | |
432 | | - | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
433 | 434 | | |
434 | | - | |
| 435 | + | |
435 | 436 | | |
436 | | - | |
437 | | - | |
438 | | - | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
439 | 440 | | |
440 | 441 | | |
441 | | - | |
442 | | - | |
443 | | - | |
| 442 | + | |
444 | 443 | | |
445 | | - | |
| 444 | + | |
446 | 445 | | |
447 | 446 | | |
448 | 447 | | |
449 | | - | |
| 448 | + | |
450 | 449 | | |
451 | 450 | | |
452 | 451 | | |
| |||
0 commit comments