fix: persist mobile sessions by matching the API auth cookie prefix - #155
fix: persist mobile sessions by matching the API auth cookie prefix#155adelrodriguez wants to merge 2 commits into
Conversation
|
Pullfrog stalled — likely cause: The agent stopped emitting events for 120s and was killed by the activity-timeout watchdog. 88 events were processed before the failure. Recent agent stderr
|
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
e1d22c1 to
1e3a85f
Compare
There was a problem hiding this comment.
Important
The new shared default breaks session persistence for the generated Convex mobile client and must be corrected before merge.
Reviewed changes
Reviewed the complete rebased authentication change because no earlier Pullfrog review exists.
- Centralized the API prefix: Added
AUTH_API_COOKIE_PREFIXand used it in the Hono API auth configuration. - Changed Expo cookie filtering: Made the shared Expo client default to the Hono API's
init-apicookie prefix while retaining caller overrides.
GPT Sol | 𝕏
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
claude-fable-5 (on behalf of Adel): Good catch — confirmed against |
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
Reviewed the backend-neutral cookie-prefix correction added since the prior Pullfrog review.
- Restored the shared prefix: Changed the Expo wrapper default to
AUTH_COOKIE_PREFIX, which preserves Convex mobile sessions. - Scoped the Hono override: Passed
AUTH_API_COOKIE_PREFIXfrom the Hono mobile auth template, so generated API clients persistinit-api.*cookies.
GPT Sol | 𝕏

Stacked on #151. Flagged there by review: the generated Expo auth client has never persisted a session, against either cookie prefix.
@better-auth/expogates all cookie storage behind astartsWith(cookiePrefix)check that defaults to"better-auth", and ourexpoClientwrapper never passedcookiePrefix— so everyinit.*(and nowinit-api.*) cookie the API issues was silently dropped and mobile users were signed out on every app restart.The wrapper now passes the API's cookie prefix, since the generated mobile client targets
apps/api(EXPO_PUBLIC_API_URL=http://localhost:3000). Callers can still override it via the options spread when pointing at a different backend.Along the way the
init-apiprefix moved from an inline template literal inapps/apiintoAUTH_API_COOKIE_PREFIXinpackages/auth/src/constants.ts, so both sites that must agree on it — the API's auth instance and the Expo client — read one constant.Written by Claude Fable 5 via Claude Code.
🤖 Generated with Claude Code