---
title: Integration with WhiteLabel
slug: connect/integration-with-whitelabel
docTags: 
createdAt: 2023-12-27T07:20:43.634Z
---

# Integration in mobile apps

The mobile App needs to support the following capabilities:

1. The app needs to support deep link ([IOS universal-links](https://developer.apple.com/documentation/xcode/supporting-universal-links-in-your-app/) or [Android App Links](https://developer.android.com/training/app-links) or [custom URL scheme](https://developer.apple.com/documentation/xcode/defining-a-custom-url-scheme-for-your-app) ) so that jumping to `redirectUrl` can open your app after data sharing completed.
2. If Link uses Webview integration, the app needs to be developed so that the institution's authorization page in Webview can launch the institution's App for data sharing authorization. (For a detailed description of Open Finance's App-to-App redirection see: [Redirecionamento App-to-App](https://openfinancebrasil.atlassian.net/wiki/x/WgF6) )

::::ExpandableHeading
## Integrate with webview

The default WebView is unable to launch third-party apps directly. so app developers need to modify the WebView configuration to allow users to leverage native bank apps for subsequent operations after initial authorization.



### IOS integration

The iOS/Android native webview can handle universal-links/applinks by default。

So if you do not need to support **custom URL scheme**, then do not need to refer to the following sample code.

For example:

:::CodeblockTabs
```objective-c
- (void)webView:(WKWebView *)webView decidePolicyForNavigationAction:(WKNavigationAction *)navigationAction decisionHandler:(void (^)(WKNavigationActionPolicy))decisionHandler {
    NSURL *url = navigationAction.request.URL;
    NSString *scheme = [url scheme];
    if (![@[@"http", @"https"] containsObject:scheme]) {
        if ([[UIApplication sharedApplication] canOpenURL:url]) {
            [[UIApplication sharedApplication] openURL:url];
        }
        decisionHandler(WKNavigationActionPolicyCancel);
    } else {
        decisionHandler(WKNavigationActionPolicyAllow);
    }
}
```

```swift
func webView(_ webView: WKWebView, decidePolicyFor navigationAction: WKNavigationAction, decisionHandler: @escaping (WKNavigationActionPolicy) -> Void) {
    let url = navigationAction.request.url
    if !["http", "https"].contains(url.scheme ?? "") {
        if UIApplication.shared.canOpenURL(url) {
            UIApplication.shared.open(url, options: [:], completionHandler: nil)
        }
        decisionHandler(.cancel)
    } else {
        decisionHandler(.allow)
    }
}
```
:::



### Android integration

The iOS/Android native webview can handle universal-links/applinks by default。

So if you do not need to support **custom URL scheme**, then do not need to refer to the following sample code.

For example:

:::CodeblockTabs
```java
@Override
public boolean shouldOverrideUrlLoading(WebView view, WebResourceRequest request) {
    String scheme = request.getUrl().getScheme();
    if (!Arrays.asList(new String[]{"http", "https"}).contains(scheme)) {
        try {
            Intent intent;
            if (scheme.equals("intent")) {
                intent = Intent.parseUri(request.getUrl().toString(), Intent.URI_INTENT_SCHEME);
            } else {
                intent = new Intent(Intent.ACTION_VIEW, request.getUrl());
            }
            intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
            startActivity(intent);
        } catch (ActivityNotFoundException e | URISyntaxException e) {
            e.printStackTrace();
        }
        return true;
    }
    return super.shouldOverrideUrlLoading(view, request);
}
```

```kotlin
override fun shouldOverrideUrlLoading(view: WebView?, request: WebResourceRequest?): Boolean {
    val scheme = request?.url?.scheme
    if (scheme != null && !listOf("http", "https").contains(scheme)) {
        try {
            val intent = if (scheme == "intent") {
                Intent.parseUri(request.url.toString(), Intent.URI_INTENT_SCHEME)
            } else {
                Intent(Intent.ACTION_VIEW, request.url)
            }
            intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
            startActivity(intent)
        } catch (e: ActivityNotFoundException) {
            e.printStackTrace()
        } catch (e: URISyntaxException) {
            e.printStackTrace()
        }
        return true
    }
    return super.shouldOverrideUrlLoading(view, request)
}
```
:::

### Flutter integration

&#x20;[Flutter integration](docId\:UqzIHAJDokYz3K1UGmb3s)

### React Native integration

[React Native integration](docId\:PUjMJkOxMhba9vuM7MISO)


::::

::::ExpandableHeading
## Integrate with system browser

You can also have the app call the system browser to open the Klavi link URL for authorization and data sharing. so that you do not need to modify the app in order to launch the institution's app in the webview.

You need to take care of a few things:

1\. You App directly launch the system browser to open Klavi's link URL.

For example:

:::CodeblockTabs
ObjectiveC(IOS)

```objective-c
NSString *urlString = @"https://open-sandbox.klavi.ai/data/v1/basic-links/yourappid?redirectURL=https://your-web-site.com/your-authorization-result-page";
NSURL *url = [NSURL URLWithString:urlString];
if ([[UIApplication sharedApplication] canOpenURL:url]) {
    [[UIApplication sharedApplication] openURL:url options:@{} completionHandler:^(BOOL success) {
        if (success) {
            NSLog(@"URL was opened successfully.");
        } else {
            NSLog(@"Failed to open URL.");
        }
    }];
}
```

Java(Android)

```java
String urlString = "https://open-sandbox.klavi.ai/data/v1/basic-links/yourappid?redirectURL=https://your-web-site.com/your-authorization-result-page";
Uri uri = Uri.parse(urlString);
Intent intent = new Intent(Intent.ACTION_VIEW, uri);

if (intent.resolveActivity(getPackageManager()) != null) {
    startActivity(intent);
}
```
:::

In the system browser, the user accesses the Klavi link for the authorization data sharing flow,  after the authorization sharing is completed klavi will redirect to the redirectURL page（The `redirectURL` in the example is `https://your-web-site.com/your-authorization-result-page`）

2\. Launch your app on the `redirectURL` page in the system browser, displaying the authorization sharing results and guiding the user through the subsequent flow.

This example is based on the app's deep link is using **custom URL scheme**.&#x20;

:::hint{type="info"}
If your app deep link supports **IOS universal-links** or **Android App Links**, Then consult the documentation for specific technical details [Supporting universal links in your app](https://developer.apple.com/documentation/xcode/supporting-universal-links-in-your-app/) or [Handling Android App Links](https://developer.android.com/training/app-links) .
:::



For example (**custom URL scheme**):

:::CodeblockTabs
redirectURL page

```html
<!doctype html>
<html lang="pt-BR">

<head>
  <meta charset="UTF-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <title>Redirecting...</title>
  <script>
    const { search } = window.location;
    /**
     * launch your app
    */
    window.location.href = `yourapp://your-authentication-result-path${search}`
  </script>
</head>

<body>
  <div>Redirecting...</div>
</body>

</html>
```
:::
::::

# Iframe Embedding Restrictions

The bank authorization page prohibits access through iframes. This prevents end users from logging into their bank accounts from within the WhiteLabel app or web pages.
