Skip to content

fix(android): sync Cronet and token-refresh with CookieManager#70

Closed
oferRounds wants to merge 1 commit into
margelo:mainfrom
oferRounds:pr/android-cookie-manager-sync
Closed

fix(android): sync Cronet and token-refresh with CookieManager#70
oferRounds wants to merge 1 commit into
margelo:mainfrom
oferRounds:pr/android-cookie-manager-sync

Conversation

@oferRounds
Copy link
Copy Markdown
Contributor

@oferRounds oferRounds commented Apr 11, 2026

Summary

Compared to main: Android Nitro fetch and cold-start token refresh now participate in the system CookieManager cookie jar so session cookies are shared with the WebView stack where applicable.

What changes

  • NitroFetchClient (Cronet): If the request has no Cookie header, cookies for the URL are read from CookieManager and attached. Set-Cookie from responses is written back (including on redirects that are followed).
  • AutoPrefetcher (token refresh over HttpURLConnection): Same pattern for the refresh request: optional cookie from the jar when not overridden; persist Set-Cookie from a successful refresh response. Non-success HTTP status is logged before failing the refresh.

Why

Cookie-based sessions (e.g. SAML) often rely on CookieManager; Cronet does not use that store by default without this wiring.

How to verify

  • Cold start with autoprefetch queue + registerTokenRefresh for fetch: confirm authenticated prefetches after a cookie-updating refresh.

- NitroFetchClient: attach Cookie from CookieManager when request has no Cookie header;
 persist Set-Cookie from responses (including redirects).
- AutoPrefetcher: same for HttpURLConnection token refresh; persist Set-Cookie from refresh response.

Helps SAML/session flows where the session cookie lives in the WebView cookie jar.

Made-with: Cursor
@riteshshukla04
Copy link
Copy Markdown
Collaborator

Closing this for #73

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