launch

suspend fun launch(url: URL, redirectUri: Uri = this.redirectUri): Result<Uri>

Launches a URL in a browser tab and waits for authentication to complete.

This method handles the complete lifecycle of a browser-based authentication flow:

  1. Launches the appropriate browser tab (Auth Tab or Custom Tab based on device support and URI scheme)

  2. Waits for the authentication process to complete

  3. Returns the redirect URI containing authentication results

The method uses a mutex lock to ensure only one browser launch can happen at a time.

Return

A Result containing the redirect Uri with authentication results on success, or an appropriate exception on failure.

Parameters

url

The authentication URL to launch in the browser.

redirectUri

The URI to which the authentication server should redirect after completion. If not provided, the global redirectUri property is used.