Missing WebView events: Navigating / Navigated / ReloadRequested
See original GitHub issueI’m trying to use a WebView for OIDC sign in. After logging in, the identity service redirects to another URL. In non-Blazor apps, I’d subscribe to the WebView.Navigating event to handle the redirect and read authorization codes or tokens.
However, these events appear to be missing in the WebView provided by MobileBlazorBindings. Is there a way to subscribe to this event currently?
Version I’m using: 0.5.50-preview
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Missing WebView events: Navigating ...
I'm trying to use a WebView for OIDC sign in. After logging in, the identity service redirects to another URL. In non-Blazor apps, ......
Read more >Refreshing webview after setting source or navigating ...
this works - as soon as i run the app YouTube is loaded. But when I uncomment the wv.Refresh it stops working -...
Read more >Navigation events for WebView2 apps
WebView2 starts to navigate and the navigation results in a network request. The host may disallow the request during the event. Block unwanted ......
Read more >WebView and Android back button navigation
Handling page navigation and page reload if there's no content; Handling back button navigation; Analyzing accessed URLs; Showing a loading ...
Read more >Known Issues in WebView control - Windows
This guide highlights known limitations with the current release of the WebView control for Windows Forms and WPF applications.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Hi @cornem. The Navigating and Navigated events are indeed not exposed ATM. We will expose them in the future. A few things need to happen for that:
However using a webview for auth is discouraged on iOS, macOS and Android. The webview does not show an URL and the users cannot inspect the certificate easily, opening the door to MITM attacks. That is why on iOS and macOS and Android steps were taken to block this. E.g. on mobile platforms redirecting to a custom scheme in a normal webview isn’t allowed anymore. Likewise Google servers detect an embedded webview and will block auth based on the User agent. I would not use a webview a.t.m. for auth.
https://www.gluu.org/blog/webviews-are-bad-use-appauth/ https://www.oauth.com/oauth2-servers/oauth-native-apps/use-system-browser/
What we will add in the next preview (possible in the nightlies already in a week or so) is add Auth to MBB based on the OS intrinsic mechanisms of the platform. Xamarin Essentials exposes these as WebAuthenticator for iOS, macOS and Android. We will write our own version for windows.
The advantage of using a platform secure webview or custom tabs is that extensions are allowed to run (so password managers work), whereas in a normal webview they won’t.
You can find some early preview videos here:
https://youtu.be/-mqT1uOVmco https://youtu.be/X4PwEf3VC3g https://youtu.be/S_ppoP-LftE
Unfortunately the logout experience is poor on iOS and macOS. There is an additional popup requesting login, when you actually logout. This can be prevented by using a private browsing session (not sharing cookies with the main browser), but unfortunately Xamarin essentials does not expose that parameter. We will ask the Xamarin team to add this feature.
I have an initial implementation of Auth in #215. It’s just not finished yet, but will take a week or two more. Then it will be part of MBB.