Verifies if the web authentication flow is available on the current device.
Android: Returns true if the user's device has Google Chrome installed, enabled, and supports
Google Chrome Auth Tabs,
which are required to perform the authentication flow.
iOS: Returns true on iOS 17.4 or later, which is the minimum version supporting
HTTPS callbacks
in ASWebAuthenticationSession. Returns false on earlier versions.
A boolean value indicating whether the web auth flow is available on the user's device.
Successful execution of this method depends on the callback host being verifiably associated with your app on each platform:
Android: the package_name and sha256_cert_fingerprints values in the target domain's
assetlinks.json
must match those belonging to your app. For testing, running
adb shell pm set-app-links --package [PACKAGE_NAME] 2 all temporarily bypasses those requirements.
iOS: the callback host must be declared in the app's Associated Domains entitlement
(applinks:[HOST]) and served by an
apple-app-site-association
file on that domain.
Starts a web-based authentication flow, opening the start URL in a secure browser tab.
The flow completes when the browser redirects to the callback path on the host domain.
Platform availability: Android and iOS (17.4 or later). Always check isAvailable before calling this method, as this method throws when the flow is unavailable on the device.
Example:
const modules = await Eitri.modules();
const isAvailable = modules?.webAuth?.isAvailable;
if (!isAvailable) {
console.log("Web auth flow is not available on this device.")
return
}
const available = await isAvailable()
if (!available) {
console.log("Web auth flow is not available on this device.")
return
}
const startAuthFlow = modules?.webAuth?.startAuthFlow;
if (!startAuthFlow) return;
const result = await startAuthFlow({
startUrl: "https://www.example.com/oauth/authorize?client_id=abc&redirect_uri=...",
redirectHost: "www.example.com",
redirectPath: "/oauth/callback"
})
Object with startUrl,
redirectHost, and
redirectPath attributes.
Object with the authUrl attribute,
containing the full redirect URL captured when the auth flow completes.
Generic web authentication flow service. Launches a browser-based auth flow in a secure browser tab and captures the redirect URL.
This service provides a generic mechanism for performing web-based authentication flows. It opens a start URL in a secure browser tab, monitors for a redirect to a callback path on the specified host domain, and returns the full redirect URL (including any auth tokens or codes as query parameters).
Requirements: This feature must be enabled in the Eitri Shopping App native configuration by setting
useWebAuthService: { active: true }in the app configuration file.Platform availability: Android and iOS. Each platform has its own device requirements — Android requires Google Chrome with Auth Tab support, and iOS requires 17.4 or later. Always check isAvailable before starting a flow.