Korzen
Bot Protection
In these docs

Mobile apps

Bot Protection in a mobile app's sign-up: the tag runs in the system browser and in a WebView, an app's own web pages send its token, a native screen has none.

The tag runs wherever a browser engine shows your page. In a mobile app that is three places: a page opened in the system browser, your site's page in a WebView, and the app's own web pages, as Capacitor and Ionic build them. A native screen runs no tag. This guide says what was tried on Android 15, in the emulator, with Chrome and Android System WebView 124; iOS was not tried.

Where the sign-up runsThe tagWhat changes from the web
Your site's page in the system browser (Chrome Custom Tabs)runsnothing: the page and the call of your framework's guide
Your site's page in the app's WebViewruns, with JavaScript and DOM storage onthe WebView's settings
The app's own web pages, at https://localhostrunsthe token goes in a header to your API
A native screennonenot a protected action

A person in the Custom Tab, in the WebView and in the app's own page got the same answer as in Chrome on the same device: a WebView is not judged a bot for being one.

The system browser

A Custom Tab is Chrome, with Chrome's cookies: your sign-up page, its tag and your server's call work as on the web, with nothing to change.

Your site's page in a WebView

Android's WebView starts with JavaScript and DOM storage off, and the tag needs both. Turn them on, and accept cookies, so the form posts the _kz cookie with it:

WebView web = new WebView(this);
web.getSettings().setJavaScriptEnabled(true);
web.getSettings().setDomStorageEnabled(true);
CookieManager.getInstance().setAcceptCookie(true);
web.loadUrl("https://example.com/signup");

The page and the server's call are your framework's guide, unchanged.

The app's own web pages

Capacitor serves an app's pages on Android at https://localhost. Pages on localhost always accept the tag, so there is no domain to add. Put the tag in index.html:

<script src="https://eu.korzen.dev/v1/tag.js" data-site-key="YOUR_SITE_KEY" async></script>

Your API is on another origin, which never sees the page's _kz cookie. Before the call, window.korzen?.ready() gives the token: send it as the x-korzen-token header:

const token = await window.korzen?.ready();
const res = await fetch("https://api.example.com/signup", {
  method: "POST",
  headers: { "content-type": "application/json", ...(token ? { "x-korzen-token": token } : {}) },
  body: JSON.stringify({ email }),
});

On the server, the call of your framework's guide reads that header before the cookie. Let the header through CORS: Access-Control-Allow-Headers lists x-korzen-token.

What was tried is a page the app loads at https://localhost in its WebView, as Capacitor does, not a Capacitor project.

A native screen

A sign-up from a native screen carries no token, so the decision is uncertain and, on a protected action, asks for the token: block mode then blocks it. Call Bot Protection on the route your app calls without protectedAction, or leave the route off, and choose what an uncertain visitor gets on the dashboard.

If your server verifies App Attest or Play Integrity, send "device_attested": true in context. It vouches for the device and the app, not for a person: a farm of real phones passes it. Tried here, it did not change the class of a call without a token on its own. Context

Test it on your machine

  1. In the Android emulator, adb reverse tcp:3000 tcp:3000 makes the emulator's localhost:3000 your machine's, so the app opens your local server.
  2. Open the sign-up page in the app and wait a few seconds. In Chrome's chrome://inspect, with WebView.setWebContentsDebuggingEnabled(true) in a debug build, the page shows the _kz cookie.
  3. Sign up. The decision shows on the dashboard's Decisions page. The emulator draws with software, which counts against it: a real phone tells you more.