Repository navigation
[SDK-193] JWT auth example - #73
Merged
Merged
Conversation
Enable the Expo example to exercise Iterable JWT login without changing the default email path or the plugin public API. Co-authored-by: Cursor <cursoragent@cursor.com>
Keep .agent, .cursor, and similar editor/agent folders out of version control. Co-authored-by: Cursor <cursoragent@cursor.com>
Keep local review and design artifacts out of version control. Co-authored-by: Cursor <cursoragent@cursor.com>
Hermes has no SubtleCrypto, so the Web Crypto signer failed on iOS and Android. Co-authored-by: Cursor <cursoragent@cursor.com>
Helpers take explicit enabled/secret args so tests do not depend on inlined EXPO_PUBLIC env. Prefetch failures Alert without PII and skip setEmail without a token. Co-authored-by: Cursor <cursoragent@cursor.com>
|
Coverage Impact This PR will not change total coverage. 🚦 See full report on Qlty Cloud »🛟 Help
|
❌ 1 blocking issue (1 total)
|
rtlsilva
requested changes
Aug 28, 2026
rtlsilva
approved these changes
Sep 1, 2026
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.

🎟️ JIRA ticket(s)
🏕 Description
Adds an opt-in JWT auth demo to the Expo plugin example app so a JWT-enabled mobile API key can be exercised the same way as the RN example (SDK-191), without native JWT modules or a backend.
Default login is unchanged: email + a non-JWT API key. JWT is off unless
EXPO_PUBLIC_ITERABLE_JWT_ENABLED=trueand a realEXPO_PUBLIC_ITERABLE_JWT_SECRETare set inexample/.env.local.When JWT is configured:
Iterable.initializegetsauthHandler,onJwtError, andretryPolicy{ maxRetry: 5, retryInterval: 5, retryBackoff: linear }{ email, iat, exp }, 1-day TTL) and callsIterable.setEmail(email, token)onJwtError/ prefetch failure show an Alert with failure reason only (no JWT,authToken, email,userId,userKey, orfailedAuthToken)authHandler(match RN)Signer is demo-only (pure JS HMAC-SHA256; Hermes has no SubtleCrypto). Production apps must fetch the token from a backend that holds the secret —
EXPO_PUBLIC_*values are inlined into the JS bundle.Out of scope: plugin pipeline /
app.jsonoptions, native JWT modules,userIdlogin, plugin README / Zendesk, changelog / version bump (example-only;example/is not published).Also ignores local agent tooling dirs (
.agent/,.artifacts/,.cursor/, etc.) so they are not committed by accident.📷 Screenshots
No Login layout changes. JWT failures show a system Alert (
JWT authentication failed+ reason). Screenshots optional after device verification.🧐 Testing
Unit (done on this branch)
yarn tsc --noEmityarn tsc --noEmit -p exampleyarn lintyarn test— includessignDemoJwt(payload + NodecreateHmacsignature match) anddemoAuth(flags,authHandler/retryPolicy/onJwtError, Alert does not includeuserKeyorfailedAuthToken)Default path (JWT off) — iOS and Android
example/.env→example/.env.localnpx expo prebuild --cleanand run the exampleJWT enabled, valid key + secret — iOS and Android
.env.local: set that API key,EXPO_PUBLIC_ITERABLE_JWT_ENABLED=true,EXPO_PUBLIC_ITERABLE_JWT_SECRET=<secret>userIdin logs or AlertsJWT failure paths (app must not crash)
YOUR_ITERABLE_JWT_SECRET— noauthHandler; login may leave Login; inbox/in-app do not load as a JWT sessiononJwtErrorAlert with reason only; UI may still leave Login; inbox/in-app do not load📝 Documentation
How have you documented these changes?
example/README.md— new JWT authentication (optional) section: env vars (EXPO_PUBLIC_ITERABLE_JWT_ENABLED,EXPO_PUBLIC_ITERABLE_JWT_SECRET, existing API key / email), how to create a JWT-enabled mobile API key, demo-only secret warning (EXPO_PUBLIC_*inlined), and that productionauthHandlershouldfetchfrom a backendexample/.env— commented JWT template next to the existing API key / email varsexample/src/jwt/demoAuth.ts—getDemoAuthTokencomment with a backendfetchstub and DEMO ONLY markingNo plugin
README.md, Zendesk, orCHANGELOG.mdupdate (ticket: example docs only; no public plugin options).