feat: adopt native SDK majors (Android v4, Swift v3) for v6 - #1619
Conversation
…e-auth0 into feat/adopt-auth0-android-v4-swift-v3
📝 WalkthroughWalkthroughThe change upgrades Auth0 native SDK integrations and platform requirements. It replaces relative SSO expiration values with absolute timestamps, updates normalized error codes, adapts Android and iOS APIs, and refreshes migration guidance, examples, and tests. ChangesAuth0 SDK migration
Estimated code review effort: 4 (Complex) | ~45 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 8
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@EXAMPLES.md`:
- Line 1973: Update the `expiresAt` labels in all three examples to explicitly
include the unit `(UNIX seconds)`, covering the occurrences near lines 1973,
2015, and 2050, without changing the surrounding example behavior.
In `@ios/NativeBridge.swift`:
- Around line 253-260: Update the clear-error handling in both affected paths
around the visible `credentialsManager.clear()` calls to reject caught failures
instead of converting them to `removed = false`. Map `CredentialsManagerError`
instances with `reactNativeErrorCode()`, and map all other errors to the generic
credentials-manager error code, preserving the existing successful clear
behavior.
In `@MIGRATION_GUIDE.md`:
- Around line 115-131: Update the “Removed and added WebAuthErrorCodes” section
to state that only three codes were removed, while PKCE_NOT_ALLOWED remains
available on Android but is no longer raised on iOS. Keep the existing per-code
table and action guidance consistent with this platform distinction.
In `@README.md`:
- Around line 893-894: Update the README error-mapping table’s INVALID_STATE row
to document the state_mismatch discriminator used by WebAuthError,
distinguishing it from ACCESS_DENIED while preserving the existing mappings.
In `@src/core/models/__tests__/SSOCredentials.spec.ts`:
- Around line 59-74: Ensure the Date.now mock created in the “should convert the
relative expires_in into an absolute expiresAt” test is restored even when
conversion or assertion fails, preferably by moving cleanup to the test suite’s
afterEach or wrapping the test body in try/finally; remove the current
success-only mockRestore call.
In `@src/core/models/CredentialsManagerError.ts`:
- Around line 65-68: Add SSO_EXCHANGE_FAILED and CLEAR_FAILED to the exported
CredentialsManagerError JSDoc type list, alongside the existing error-type
values, so the documented type contract matches the public constants.
In `@src/core/services/__tests__/AuthenticationOrchestrator.spec.ts`:
- Around line 911-913: Update the test around the AuthenticationOrchestrator
invocation to freeze Date.now() before invoking the orchestrator, use that
controlled clock for the expiresAt assertion, and restore the clock during test
cleanup.
In
`@src/platforms/native/adapters/__tests__/NativeCredentialsManager.errors.spec.ts`:
- Around line 239-269: The token-exchange parameterized tests incorrectly
exercise CLEAR_FAILED through getCredentials. Update the tests around
exchangeErrorTestCases to remove the clear cases, add a separate clear-error
table for CLEAR_FAILED and clearFailed, mock mockBridge.clearCredentials, invoke
manager.clearCredentials(), and assert using a clear-specific message while
preserving the existing exchange cases.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 7c03892f-6e09-4352-9ea1-ece0840dfa7c
⛔ Files ignored due to path filters (1)
example/ios/Podfile.lockis excluded by!**/*.lock
📒 Files selected for processing (25)
A0Auth0.podspecEXAMPLES.mdMIGRATION_GUIDE.mdREADME.mdandroid/build.gradleandroid/gradle.propertiesandroid/src/main/java/com/auth0/react/A0Auth0Module.ktexample/android/app/build.gradleexample/android/build.gradleios/A0MfaClient.swiftios/MyAccount.swiftios/NativeBridge.swiftios/Passwordless.swiftsrc/core/models/CredentialsManagerError.tssrc/core/models/SSOCredentials.tssrc/core/models/WebAuthError.tssrc/core/models/__tests__/ErrorCodes.spec.tssrc/core/models/__tests__/SSOCredentials.spec.tssrc/core/services/__tests__/AuthenticationOrchestrator.spec.tssrc/hooks/__tests__/Auth0Provider.spec.tsxsrc/platforms/native/adapters/__tests__/NativeCredentialsManager.errors.spec.tssrc/platforms/native/adapters/__tests__/NativeCredentialsManager.spec.tssrc/platforms/native/adapters/__tests__/NativeWebAuthProvider.errors.spec.tssrc/specs/NativeA0Auth0.tssrc/types/common.ts
Changes
Adopts the new native SDK majors — Auth0.Android 4.0.1 and Auth0.swift 3.0.1 — as the foundation for v6, and aligns the TypeScript surface with the API changes they bring.
Two breaking changes reach consumers:
SSOCredentials.expiresInis nowexpiresAt. Both native SDKs replaced the relative TTL with an absolute expiry, so the field is now an absolute UNIX timestamp in seconds, consistent withCredentials.expiresAt. Callers should stop adding it to the current time.WebAuthErrorCodesgained and lost members.NO_BUNDLE_IDENTIFIER,NO_AUTHORIZATION_CODE, andINVALID_INVITATION_URLcan no longer be raised by Auth0.swift 3.0 and were removed;AUTHENTICATION_FAILEDandCODE_EXCHANGE_FAILEDwere added for its new cases.PKCE_NOT_ALLOWEDremains but is now Android-only.Alongside that, iOS error mapping is materially better: server-returned errors such as
access_deniedandinvalid_requestnow surface as their specific codes instead of collapsing intoUNKNOWN_ERROR, because the underlying code is unwrapped from the error's cause.SSO_EXCHANGE_FAILEDandCLEAR_FAILEDare likewise reported instead of being flattened into a generic credentials-manager error. Passkey sign-in now opts into ID-token claim validation on iOS, matching what Android already did — Auth0.swift 3.0 madevalidateClaims()opt-in on direct token requests.Build floors rise with the native majors: Android moves to minSdk 26, compile/target 36, JDK 17, Kotlin 2.0.21, and AGP 8.10.1; iOS builds against Swift 6 with the deployment target inherited from React Native's
min_ios_version_supported.MIGRATION_GUIDE.md,README.md, andEXAMPLES.mdare updated in step.Summary by CodeRabbit
New Features
expiresAttimestamp.Bug Fixes
Documentation
Chores