feat: expose cold-start fetch token-refresh outcome to JS#74
Draft
oferRounds wants to merge 3 commits intomargelo:mainfrom
Draft
feat: expose cold-start fetch token-refresh outcome to JS#74oferRounds wants to merge 3 commits intomargelo:mainfrom
oferRounds wants to merge 3 commits intomargelo:mainfrom
Conversation
- 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
This was referenced Apr 11, 2026
- NitroCookieSync: shared attach + Set-Cookie helpers; flush only when cookies applied - Cronet: apply Set-Cookie on redirects without flush; flush once on success when redirects or final response stored cookies - HttpURLConnection token refresh: reuse attach helper; Set-Cookie + flush only if needed Made-with: Cursor
- Android AutoPrefetcher: persist last outcome to SharedPreferences (plaintext key nitro_token_refresh_fetch_last_outcome) at each exit: success, failed_skip, failed_cache, none, not_run, error. - iOS NitroAutoPrefetcher: mirror outcome writes to UserDefaults. - JS: getFetchTokenRefreshLastOutcome(); clearTokenRefresh removes the outcome key. Depends on Android CookieManager sync PR for a clean AutoPrefetcher history. Made-with: Cursor
b2927ee to
04f649a
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Review note
Until #73 is in
main, Files changed here includes cookie + outcome (both targetmain; the cookie branch only exists on the fork). Outcome-only diff: oferRounds/react-native-nitro-fetch#1.Summary
Cold-start native fetch token refresh (before JS runs) records a plaintext last outcome readable from JavaScript (
getFetchTokenRefreshLastOutcome()), and that value is cleared when fetch token refresh config is cleared (clearTokenRefresh).Outcome values:
success|failed_skip|failed_cache|none|not_run|error| empty string if unset.Merge order
Merge #73 first, then rebase this branch onto
mainso the upstream diff is outcome-only.Split from #71
Atomic PR 2 of 2 per review on #71.
How to verify
Register fetch token refresh, relaunch with a queued autoprefetch, read
getFetchTokenRefreshLastOutcome()after startup; confirm it matches the native path and clears afterclearTokenRefresh('fetch').