Web interface that allows users to navigate through a complex web flow.

🚨 Android limitations: only available for Android Pie (API 28) or higher

Usage

It can be used for corporate logins and other complex web flows involving multiple redirects in an OAuth flow.

The web flow interface has an internet browser that can be controlled by the user while respecting restrictions defined here.

Every navigation is recorded and can be accessed after the web flow is finished.

Notes

Data persistence inside a web flow is enabled in modern Operating Systems (Android 9+, iOS 17+).

This means that the web flow will remember the state of the browser and the cookies between navigations and app sessions.

Camera and microphone

Pages inside a web flow can request the camera and microphone (e.g. via navigator.mediaDevices.getUserMedia), and the user is asked to grant access. This only works if the native app declares the corresponding permissions, so ask the native developers of the host app to add them:

  • Android (AndroidManifest.xml):
    <!-- camera -->
    <uses-permission android:name="android.permission.CAMERA" />

    <!-- microphone: both are required -->
    <uses-permission android:name="android.permission.RECORD_AUDIO" />
    <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
    The Android WebView only opens the microphone when the app holds both RECORD_AUDIO and MODIFY_AUDIO_SETTINGS; if either is missing, microphone access is denied without prompting the user. MODIFY_AUDIO_SETTINGS is granted at install time and never shows a prompt.
  • iOS (Info.plist):
    • camera: NSCameraUsageDescription
    • microphone: NSMicrophoneUsageDescription

Both platforms support camera and microphone requests from the page. iOS supports them on every API level; Android supports them from API LEVEL 39, and on older versions denies them regardless of the declared permissions.

Declare only what the page needs. On Android, an undeclared permission is denied without prompting the user and the page receives a NotAllowedError. A request is granted only as a whole: if a page requests camera and microphone together and either one is undeclared or denied, the entire request fails with NotAllowedError. Request them separately when one of them is optional.

Hierarchy

  • WebFlow

Methods

Methods

  • Starts a web flow

    Example:

    const userNavigation = await Eitri.webFlow.start({
    "startUrl": "https://domain/startLogin",
    "stopPattern": "/oauth/finish",
    "allowedDomains": ["www.google.com"]
    })

    Receiving messages from the page

    Pass bridgeName and eventCallback together to install a JavaScript bridge inside the web flow, so the page can send messages back to your eitri-app while the flow is running.

    const userNavigation = await Eitri.webFlow.start({
    "startUrl": "https://domain/startLogin",
    "stopPattern": "/oauth/finish",
    "allowedDomains": ["www.google.com"],
    "bridgeName": "myBridge",
    "eventCallback": (message) => {
    console.log(message.bridgeName, message.data);
    }
    })

    The page then sends messages with:

    window.myBridge.postMessage(JSON.stringify({ status: "ok" }));
    

    eventCallback is unsubscribed automatically when the web flow finishes, so there is nothing to clean up.

    Compatibility Control

    • API LEVEL 23 - Functionality added
    • API LEVEL 25 - Adds support for keepLoadingScreenUntilDomainChange
    • API LEVEL 33 - Adds support for userAgent
    • API LEVEL 34 - Adds support for cookies
    • API LEVEL 35 - Adds support for headerStyle
    • API LEVEL 38 - Adds support for bridgeName and eventCallback
    • API LEVEL 39 - Adds camera and microphone support on Android (see Camera and microphone)

    Parameters

    Returns Promise<WebFlowOutput>

Generated using TypeDoc