From 907e161b128024749db5115c2f4f50e6368f08a7 Mon Sep 17 00:00:00 2001 From: Kevin Yue Date: Thu, 5 Nov 2026 14:53:50 +0800 Subject: [PATCH] fix(auth): open Okta Verify from embedded login Forward com-okta-authenticator navigation to the desktop scheme handler on GTK platforms and cancel the WebView navigation. This lets FastPass hidden iframes launch Okta Verify. Verified the failure and fix using an HTTPS iframe fixture in the Linux VM with a temporary URI handler. Linux gpauth build, 48 auth tests, and macOS auth compile check passed. Fixes #692 --- crates/auth/src/webview/gtk.rs | 13 +++++++++++++ crates/auth/src/webview/webview_auth.rs | 2 ++ 2 files changed, 15 insertions(+) diff --git a/crates/auth/src/webview/gtk.rs b/crates/auth/src/webview/gtk.rs index 6928351..d3cdfcc 100644 --- a/crates/auth/src/webview/gtk.rs +++ b/crates/auth/src/webview/gtk.rs @@ -21,6 +21,19 @@ mod recovery_row; #[path = "gtk_tls.rs"] mod tls; +pub(super) fn open_okta_verify(url: &tauri::Url) -> bool { + if url.scheme() != "com-okta-authenticator" { + return true; + } + + // FastPass loads this URI in a hidden iframe. Hand it to the desktop instead of WebKitGTK. + info!("Opening Okta Verify"); + if let Err(error) = gtk::gio::AppInfo::launch_default_for_uri(url.as_str(), None::<>k::gio::AppLaunchContext>) { + warn!("Failed to open Okta Verify: {error}"); + } + false +} + fn action_button(label: &str) -> anyhow::Result { let button = gtk::Button::with_label(label); let spacing = gtk::CssProvider::new(); diff --git a/crates/auth/src/webview/webview_auth.rs b/crates/auth/src/webview/webview_auth.rs index 5073201..f97aa8a 100644 --- a/crates/auth/src/webview/webview_auth.rs +++ b/crates/auth/src/webview/webview_auth.rs @@ -129,6 +129,8 @@ impl<'a> WebviewAuthenticator<'a> { .title(self.window_title) .theme(native_theme(self.window_theme)) .devtools(cfg!(any(debug_assertions, feature = "release-devtools"))); + #[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "openbsd"))] + let auth_window_builder = auth_window_builder.on_navigation(super::platform_impl::open_okta_verify); let auth_window = auth_window_builder .inner_size(900.0, 650.0 + get_title_bar_height() + TOOLBAR_HEIGHT) .min_inner_size(400.0, 300.0)