Open
Conversation
There was a problem hiding this comment.
Pull request overview
This pull request adds federated JWT authentication support to the iOS SDK, enabling secure user-identified requests across all SDK endpoints. The implementation introduces an AuthManager that wraps a client-provided token provider closure, and integrates it throughout the networking stack with fail-closed semantics (requests are dropped if authentication fails).
Changes:
- Added
AuthManagerwithAuthTokenProviderclosure type for JWT token retrieval - Integrated JWT authentication into all user-identified HTTP requests (OptiTrack, RealTime, PreferenceCenter, EmbeddedMessaging, AnalyticsHelper, InAppManager)
- Implemented
OptistreamDispatcherto group events by customer identity, ensuring each batch carries a single valid JWT - Added
X-Optimove-Auth-Capable: 1header to all requests to signal auth capability to backends - Modified
AnalyticsHelperto fetch events per user identifier to ensure JWT-to-batch alignment
Reviewed changes
Copilot reviewed 40 out of 41 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| OptimoveCore/Sources/Classes/Auth/AuthManager.swift | New authentication manager coordinating JWT token retrieval from client-provided closure |
| OptimoveCore/Sources/Classes/Optistream/OptistreamDispatcher.swift | New dispatcher layer that groups events by customer and resolves JWTs before network calls |
| OptimoveCore/Sources/Classes/Optistream/OptistreamNetworking.swift | Updated to accept optional JWT parameter and attach X-User-JWT header |
| OptimoveCore/Sources/Classes/NetworkClient/NetworkClient.swift | Added X-Optimove-Auth-Capable header to all requests |
| OptimoveCore/Sources/Classes/NetworkClient/NetworkRequest.swift | Added X-User-JWT header field and String-based HTTPHeader initializer |
| OptimoveSDK/Sources/Classes/OptimoveConfig.swift | Added authTokenProvider field and enableAuth() builder method |
| OptimoveSDK/Sources/Classes/Optimove.swift | Wired AuthManager through initialization flow |
| OptimoveSDK/Sources/Classes/Optimobile/Network/KSHttpClient.swift | Integrated auth resolution with fail-closed semantics for Optimobile stack |
| OptimoveSDK/Sources/Classes/Optimobile/AnalyticsHelper.swift | Modified to fetch events per user to ensure single JWT per batch |
| OptimoveSDK/Sources/Classes/Optimobile/InApp/InAppManager.swift | Added authUserId parameter using associatedUserId helper |
| OptimoveSDK/Sources/Classes/EmbeddedMessaging/EmbeddedMessaging.swift | Added resolveJWT helper and integrated JWT into all API calls |
| OptimoveSDK/Sources/Classes/PreferenceCenter/OptimovePreferenceCenter.swift | Added resolveJWT helper and integrated JWT into all API calls |
| OptimoveSDK/Sources/Classes/Components/OptiTrack/OptiTrack.swift | Updated to use OptistreamDispatcher instead of OptistreamNetworking directly |
| OptimoveSDK/Sources/Classes/Components/RealTime/RealTime.swift | Updated to use OptistreamDispatcher instead of OptistreamNetworking directly |
| OptimoveSDK/Sources/Classes/Factories/ComponentFactory.swift | Wired authManager into component creation |
| OptimoveSDK/Sources/Classes/Services/ServiceLocator.swift | Added authManager property for dependency injection |
| OptimobileShared/OptimobileHelper.swift | Added associatedUserId helper to distinguish visitor vs authenticated users |
| Shared/Sources/Mocks/OptistreamDispatcherMock.swift | New mock for OptistreamDispatcher protocol |
| Shared/Sources/Mocks/OptistreamNetworkingMock.swift | Updated mock signature to match new protocol |
| Multiple test files | Comprehensive test coverage for auth integration across all layers |
| OptimoveCore.podspec, OptimoveSDK.podspec, OptimoveNotificationServiceExtension.podspec | Version bumped to 6.4.0 |
| OptimoveCore/Sources/Classes/Constants/SDKVersion.swift | Version bumped to 6.4.0 |
| CHANGELOG.md | Documented changes for version 6.4.0 |
| Package.resolved files | Updated Mocker dependency from 3.0.1 to 3.0.2 |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Description of Changes
Adds federated JWT authentication to the iOS SDK. When
enableAuth()is used, the SDK fetches JWTs from a client-provided closure and attaches them viaX-User-JWTon all user-identified requests.Key changes
enableAuth()on config builderuserIdentifierso JWT matches the batchgetTokenfails (request dropped)Usage
Response table:
Breaking Changes
Release Checklist
Prepare:
pod lib lintpassesBump versions in:
OptimoveCore.podspecOptimoveNotificationServiceExtension.podspecOptimoveSDK.podspecOptimoveCore/Sources/Classes/Constants/SDKVersion.swiftREADME.mdCHANGELOG.mdUpdate major version numbers in wiki (basic integration + push guides)
Integration tests
T&T Only
Mobile Only
Deferred Deep Links
Combined
Release:
pod trunk pushto publish to CocoaPodsPost Release: