Repository navigation
fix(SDK-876): prevent stale JWT on auth handler failures - #945
Merged
Merged
Conversation
Clear stale tokens on Android/iOS auth waits, notify native when JS authHandler fails, and document iOS push completion handler duty.
|
Coverage Impact ⬆️ Merging this pull request will increase total coverage on Modified Files with Diff Coverage (1)
🛟 Help
|
1 new issue
|
The timeout case drives the real 30 s await expiry and rejects the test if onAuthTokenRequested throws or does not return normally before asserting null. Reply-path tests synchronize on the auth latch instead of sleeping.
jferrao-itrbl
marked this pull request as ready for review
November 23, 2026 18:42
joaodordio
approved these changes
Nov 30, 2026
joaodordio
left a comment
Member
There was a problem hiding this comment.
LGTM just left a comment on the readme to be factually accurate!
Removes the incorrect background-time tradeoff and states the nil-handler pattern is safe whether or not the SDK is initialized. Rewords the 6.7.5 reference to through at least 6.7.5, answering PR review comment #945 (comment)
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.

📝 Summary
🎟️ Jira Ticket: SDK-876
📖 Description
Outcome: When an
authHandlerrequest fails or times out, native no longer returns a stale token on Android or iOS, JS tells native immediately whenauthHandlerfails, and the iOS push-completion gap is documented as an integrator duty. Package version stays 4.0.0.What changed (by finding)
RNIterableAPIModuleImpl.java):onAuthTokenRequestedclearspassedAuthTokenbefore each wait so a timed-out request does not return the previous token.ReactIterableAPI.swift): clearpassedAuthTokenand drainauthHandlerSemaphoresignals before each 30 s wait.AppDelegatepassesniltoIterableAppIntegrationcompletion parameters and invokes system handlers locally; README and CHANGELOG document the nil-handler pattern (README heading through at least Iterable-iOS-SDK 6.7.5): passnilto the integration methods and call system completion handlers yourself—the pattern is safe whether or not the SDK is initialized, and when initialized the native integration invokes any handler you pass with the same synchronous timing as calling it yourself right after forwarding withnil. The underlying drop whenimplementationis nil is in the native iOS SDK; nothing in the native repos was changed.Iterable.ts):passAlongAuthToken(null)on rejection, unexpected result, and synchronous throw; zombie queue entry removed.Verification
Iterable.test.ts) —passAlongAuthToken(null), logging, sync throw, zombie-queue routingRNIterableAPIModuleImplAuthTokenTest.java)AppDelegate.swiftxcrun simctl push; not runnable in this repo's CIAndroid Gradle in this workspace:
yarn test:android:unitandyarn turbo run build:androidfail in the parentiterable.sdkmonorepo layout (autolink). They were run green on an isolated rsync copy at/tmp/rn-sdk-876(same source tree).Android auth tests hardened (
f30c735a): Real 30 s timeout path, normal-return completion and exception guards, latch-synchronized reply tests (no sleeps). Earlier open nits (two 30 s waits, duplicate timeout test, indentation) are resolved; one intentional ~30 s timeout test remains by decision.🧪 How to test?
yarn test --coverage— authHandler suites inIterable.test.tsyarn test:android:unit—RNIterableAPIModuleImplAuthTokenTest(note: two tests wait ~30 s each)authHandler; confirm native does not reuse stale token after timeout🧾 Changelog
CHANGELOG.md## 4.0.0 → Fixes:authHandlerfailure fixes (Android/iOS clear + JSpassAlongAuthToken(null)).No version bump (remains 4.0.0).
📹 Loom recording if applicable
N/A
🐞 Github Issues solved
N/A
📚 Docs PR if applicable
N/A (README updated in-repo)
Open items (not blocking merge)
handleAuthFailureCalledwith a nil body → JSonJwtError(undefined).f30c735a): Hardened (real timeout path, completion and exception guards, no sleeps). Earlier nits above are resolved except one real ~30 s timeout test remains by decision.IterableAppIntegrationdrops completion handlers whenimplementationis nil (fetch path and notification-response path).