Skip to content

fix(ios): persist session across app kills via CapacitorCookies + biometric recovery#32153

Merged
Jasonnnz merged 5 commits into
mainfrom
Jasonnnz/ios-session-persist
May 26, 2026
Merged

fix(ios): persist session across app kills via CapacitorCookies + biometric recovery#32153
Jasonnnz merged 5 commits into
mainfrom
Jasonnnz/ios-session-persist

Conversation

@Jasonnnz
Copy link
Copy Markdown
Contributor

Summary

Fix iOS app losing authentication state every time the user closes and reopens the app. Two independent layers address different parts of the problem:

  1. CapacitorCookies — routes document.cookie through native HTTPCookieStorage instead of WKWebView's unreliable cookie jar, so session cookies survive app kills
  2. Biometric recovery — wires up the existing but uncalled retrieveBiometricToken() as a fallback in initSession(), so when the server-side Django session expires, Face ID / Touch ID can restore the session without a full WorkOS re-login
  3. Logout cleanup — ensures deleteBiometricToken() is called on logout so stale Keychain entries can't restore a session after explicit logout
  4. WKAppBoundDomains — declares app-bound domains in Info.plist so iOS allows full cookie and storage access for the Capacitor shell

PRs merged into feature branch

Test plan

  • Build and run the iOS app on a device
  • Sign in, then force-quit the app
  • Reopen — should be authenticated without re-login (CapacitorCookies)
  • If cookies somehow lost, Face ID should prompt and restore session (biometric recovery)
  • Sign out, then reopen — should NOT auto-recover via biometric (logout cleanup)
  • Verify dev/staging builds also work (WKAppBoundDomains covers all environments)
  • Run bun test in apps/web — all new auth-store tests pass

Part of plan: ios-session-persist.md

Jasonnnz and others added 4 commits May 26, 2026 15:00
…pp kills (#32147)

Co-authored-by: Vellum Assistant <assistant@vellum.ai>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-authored-by: Vellum Assistant <assistant@vellum.ai>
…ssing (#32150)

Co-authored-by: Vellum Assistant <assistant@vellum.ai>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-authored-by: Vellum Assistant <assistant@vellum.ai>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@Jasonnnz Jasonnnz self-assigned this May 26, 2026
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 14e08c1373

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread apps/web/src/stores/auth-store.test.ts Outdated
@Jasonnnz Jasonnnz requested a review from ashleeradka May 26, 2026 19:08
@Jasonnnz Jasonnnz merged commit 2951d90 into main May 26, 2026
7 checks passed
@Jasonnnz Jasonnnz deleted the Jasonnnz/ios-session-persist branch May 26, 2026 19:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants