How to use a URL with a custom scheme for OAuth?

When integrating with OAuth, a common pattern is to specify a redirect URL with a custom scheme (a.k.a protocol) that the application can detect (for example, myapp://auth). 3D WebView supports URLs with custom schemes, and you can detect and handle them by using the IWebView.UrlChanged event, like this:

async void Start() {
    // Get a reference to the WebViewPrefab.
    var webViewPrefab = GameObject.Find("WebViewPrefab").GetComponent<WebViewPrefab>();

    // Wait until the prefab's initialized before accessing its WebView property.
    await webViewPrefab.WaitUntilInitialized();

    webViewPrefab.WebView.UrlChanged += (sender, eventArgs) => {
        // Replace myapp:// with your custom scheme
        if (eventArgs.Url.StartsWith("myapp://")) {
            // TODO: Handle the custom scheme (e.g. parse the OAuth token from eventArgs.Url).
        }
    };
}