[UPDATE] Google Auth Flows and WebView2 #3828
Replies: 129 comments
-
This is not a solution. I'm not blaming Microsoft for it. Google is a dictator. We need to move away from Google products. The only way we can do so, if Microsoft creates a Gmail. Until then, we are all screwed. The is could get way worse, the sign in with Google is a disaster right now. We can't use it with WebView2. When WebView2 was announced, I was so excited. A powerful, fast, updated Browser embedded to .NET Application. This has been a dream for All Microsoft Developers. And now all of sudden after less than year of it's launch. Google decided to prevent us from accessing Gmail from inside Webview2. Wow. |
Beta Was this translation helpful? Give feedback.
-
@markismail7 |
Beta Was this translation helpful? Give feedback.
-
We are CEF users thinking about moving to WebView2, just waiting for #20 to be progressed. We have faced exactly this authentication issue in CEF and after some considerable effort I managed to get an OAuth access token by spawning an external browser. from our app. But as it explains in the post I have been unable to find any way of using the token for general web requests. If anyone here has any ideas that would be very useful |
Beta Was this translation helpful? Give feedback.
-
So if I use the OAuth, the user can sign in with the main browser, then once the user is signed in, the user can go back to use Webview2? It's like scratching your ear with your toe SMH. It's like we have nothing to do, but to work extra for google. Imagine every website is doing the same thing. I'm really surprised that most people are ok with it? |
Beta Was this translation helpful? Give feedback.
-
Rrrrrrrrr is swichtes from cef sharp to webview2 to use google login and now it breaks again i pissed off now |
Beta Was this translation helpful? Give feedback.
-
@markismail7 i hate the security change from google now my app loses lot of funtions 40hours of work gone now |
Beta Was this translation helpful? Give feedback.
-
Can you help me with the workaround? Not sure why you think WAB is a solution here... That's only a solution in the same way Oauth is a solution, when you know how to set the response into webview2 to make it know you are logged in. PS. I think the solution on this post |
Beta Was this translation helpful? Give feedback.
-
@federicorosso1993 I did update to the latest version, still having the same issue. How did you fix it? |
Beta Was this translation helpful? Give feedback.
-
I did not fix it. By solution I mean what should be done by Microsoft, but the problem is still there |
Beta Was this translation helpful? Give feedback.
-
Why are we paying the price for Google's problem. When a user attempts to sign in with Google, let the Webview2 opens the Chrome Edge, then after signing in, it'll load automatically back to Webview2. That's a solution. Not make me register my app for something I'm not familiar with. This whole thing is stupid. Real Hackers don't need a browser to attack Google. SMH. I don't think it's about security. |
Beta Was this translation helpful? Give feedback.
-
Here's a practice from gg. I can't point the different between my own way and this suggestion.
|
Beta Was this translation helpful? Give feedback.
-
Can you use this sample to navigate on a webview2 after the login like in a regular browser for all the Google website like Gmail and YouTube? I would like the user to be able to use my app as a browser and only use the real browser during log in, is that possible? I used a little of Google drive API for another project and I know how to ask the user the Auth code from an app and wait for the log in response, but after that I can only make another api call to access Google drive files with my own interface, I cannot set that token in a webview2 to make the user able to navigate in Google drive logged in. That's the main problem to solve |
Beta Was this translation helpful? Give feedback.
-
That's not my use case, so I haven't tested that. But I think it's ok, About the HttpListener, I have never used that before, may be there's firewall problem. |
Beta Was this translation helpful? Give feedback.
-
Don't really know what are you talking about for the httplistener, I don't have a problem with that in my other project. The problem is only with my last project where I use a webview2 as a browser and there is no way to log in to Google and watch YouTube videos after that in my own browser like app. If I can only make a oauth2 call to get the video Flux and watch it in my own interface that will only work for YouTube but not for Google drive or Gmail then there is no reason to use a webview in the first place. Of course I cannot only use my interface because I also need my browser to work on all website (not just Google services). It's crazy how difficult they made it just because they refuse to make an alternative for the Google log in... It's not even possible to use a password application like you can do for older outlook. |
Beta Was this translation helpful? Give feedback.
-
@federicorosso1993, yes this sample works fine with webview2 and doesn't require any additional google login for gmail, youtube, etc... it's easy to confirm yourself as i have... add webview2 control (with Name="wv2") to bottom of existing window, then replace the one line that spawns external browser:
with webview2 equivalent:
it appears the webview2 browser instance maintains full fidelity... we can hit F12 to open typical chrome debugger tools window and inspect that google's login cookies are indeed present. @jasonstephen15 , @markismail7, @jarno9981, @64Soft, @Simon4638 - i'm mainly posting because i want to better understand what roadblocks you are running into, so i don't waste time going down a dead end for my own project... it seems embedded browser approach is still functionally viable... so is this entirely about the change in google's policy? i.e. we're running afoul of rules if we continue to use embedded, even if it works? maybe latest webview2 (v1.0.992.28 stable, published 2021-09-27) closed previous gaps? |
Beta Was this translation helpful? Give feedback.
-
I haven't experienced logging out of my Gmail session.
…--
Mike
чт, 18 авг. 2022 г. в 21:11, hershkoy ***@***.***>:
For those who managed to login, are you experiencing random log out from
the gmail session?
We managed to do login with the user agent solution, but after some time,
the gmail session is logged out. I really would appreciate to know if there
is a solution for this (or to know if I am the only one experiencing it)
—
Reply to this email directly, view it on GitHub
<#1647 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AC5IURKX56UPY57XSQRBWK3VZZ4GNANCNFSM5CEAQZIA>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
it stays logged in for multiple days for me... every once in a while i'll notice i have to log back in but it's very infrequent |
Beta Was this translation helpful? Give feedback.
-
@Beej126 same in my case. I keep my Gmail tab open 24/7 and from time to time (once a week) Google asks me to log in again. |
Beta Was this translation helpful? Give feedback.
-
From deployment I use a UserAgent = "Chrome", and save it to my Settings, and then login to google. I change UserAgent (To Chrome's Current UserAgen) in my Settings and then restart app and all is fine. |
Beta Was this translation helpful? Give feedback.
-
hello, still no normal solution to this problem? if there is a solution, can you tell me where |
Beta Was this translation helpful? Give feedback.
-
yeah first google is blocking webview2 now external companies with websites are blocking webview2 on edge or chrome the website works fine |
Beta Was this translation helpful? Give feedback.
-
What happens when you remove "Edg/..." part from the WebView2 user agent? |
Beta Was this translation helpful? Give feedback.
-
No idea try it |
Beta Was this translation helpful? Give feedback.
-
@jarno9981 That |
Beta Was this translation helpful? Give feedback.
-
For me it gets blocked and on edge en chrome it works fine |
Beta Was this translation helpful? Give feedback.
-
google login works for me, maybe webview2 updated? |
Beta Was this translation helpful? Give feedback.
-
Does it work without any workaround @t1soft |
Beta Was this translation helpful? Give feedback.
-
@champnic was my mistake the useragent was messed up |
Beta Was this translation helpful? Give feedback.
-
@jarno9981 From my experience, it does work, however I don't know if others can log in without workaround On two computers, I was able to log into google through webview2 without using any workaround. Gmail works alright, have yet to experience random log-outs. |
Beta Was this translation helpful? Give feedback.
-
Any updates? Is there a program that can securely access google using webview? |
Beta Was this translation helpful? Give feedback.
-
Google has recently made a policy update to prohibit Google OAuth requests in embedded browsers (webviews). This means that google auth flows will not be supported in WebView2.
Our short-term recommendation for a workaround is to launch the system browser and handle the auth flow there. Google’s OAuth Sample repo has an example of how to do this. This solution will work for all app types.
Longer term, our suggestion will be to use the Web Authentication Broker (WAB) API. The WAB API is a Windows API, vetted by Google, that will enable auth flows in your native applications. This API is currently UWP-only but has plans to be available in win32 and .NET as part of the WindowsAppSDK. Please follow the team’s GitHub post for updates on that. For more guidance on how to build out these auth flows visit the WAB Sample Code.
Feel free to leave any comments or questions below. Thanks!
Beta Was this translation helpful? Give feedback.
All reactions