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.

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

    Parameters

    Returns Promise<WebFlowOutput>

Generated using TypeDoc