A Hybrid App uses both native URL requests and web views to communicate with your server. In the context of HUMAN, it’s crucial to ensure that both native requests and web views are synchronized to provide the expected behavior for end users.
Your app is considered a Hybrid App if it has ALL of the following:
WKWebView on iOS or WebView on Android) that loads your website.On iOS, if your app uses SFSafariViewController, please let us know, and we will guide you through a specific integration.
You should integrate the SDK into your native app. You may choose one of the following methods:
When starting the SDK, declare your website’s root domain in the policy. This should be the domain where the SDK will set cookies.
The SDK enables Hybrid App support ONLY for the specified domains. It checks if the website’s domain ends with one of the specified domains. For example, setting example.com will also support www.example.com and api.example.com.
You should pass the WebView instance to the SDK using the following functions:
HumanSecurity.setupWebView(webView:navigationDelegate:)HumanSecurity.setupWebView(webView:webViewClient:)Important: Do not set the navigationDelegate (iOS) or webViewClient (Android) properties after calling the setupWebView function.
On iOS, you can enable automatic detection and setup of WKWebViews by setting HSHybridAppPolicy.automaticSetup to true. This eliminates the need to manually call setupWebView for each instance.
Kotlin:
Java:
Kotlin (Activity):
Java (Activity):
Swift:
Objective-C:
.example.com) in the policy’s webRootDomains. This ensures that the SDK only intercepts requests to these domains.HumanSecurity.setupWebView(webView:webViewClient:) to set up the WebView with the SDK’s WebViewClient. Do not set the WebViewClient directly after this.HumanSecurity.setupWebView(webView:navigationDelegate:) to set up the WKWebView with the SDK’s navigationDelegate. Do not set the navigationDelegate directly after this.Notes:
HSHybridAppPolicy.automaticSetup, the SDK will automatically detect and set up all WKWebView instances without needing to call setupWebView for each one.HumanSecurity.start(appIds:policy:) function to pass an array of AppIDs and specify the relevant AppID for each API call.If your website uses Apple Pay on the Web, you should disable JavaScript evaluation by the SDK. To protect the security of Apple Pay transactions in WKWebView, Apple Pay cannot be used alongside script injection APIs (relevant for iOS 13-15). Disable JavaScript evaluation by setting the SDK’s policy accordingly.
Note: If your app targets only iOS 16 or above, you don’t need to disable JavaScript evaluation by the SDK.
Swift:
Objective-C:
If your app uses web views that are created outside the native side of the app but are still based on Apple’s WKWebView or Android’s WebView (e.g., react-native-webview), you should enable support for them in the SDK’s policy.
Kotlin:
Java:
Swift:
Objective-C: