Disclosure Statement: This site contains affiliate links, which means that I may receive a commission if you make a purchase using these links. As an eBay Partner, I earn from qualifying purchases.
Can't login on Google
-
- Posts: 513
- Joined: Thu Aug 10, 2017 12:40 pm
Can't login on Google
Hello,
It's becoming more and more often when we try to login in any Google product using CEF4Delphi, an error message appears :
"Couldn’t sign you in This browser or app may not be secure."
As shown on the image below :
https://ibb.co/DQXKvz4
Looks like the authentication should be made using the OAuth protocol. Is there any examples about how to use it with CEF4Delphi ?
Thanks
It's becoming more and more often when we try to login in any Google product using CEF4Delphi, an error message appears :
"Couldn’t sign you in This browser or app may not be secure."
As shown on the image below :
https://ibb.co/DQXKvz4
Looks like the authentication should be made using the OAuth protocol. Is there any examples about how to use it with CEF4Delphi ?
Thanks
-
- Posts: 513
- Joined: Thu Aug 10, 2017 12:40 pm
Re: Can't login on Google
Or even better, is there any workaround to avoid this error ?
Because even using OAuth would be a hassle as we need to submit informaiton to Google review and approve, have a page with details about app, a lot of burocracy...
Because even using OAuth would be a hassle as we need to submit informaiton to Google review and approve, have a page with details about app, a lot of burocracy...
- salvadordf
- Posts: 4580
- Joined: Thu Feb 02, 2017 12:24 pm
- Location: Spain
- Contact:
Re: Can't login on Google
Sadly, I don't have any new information about this.
Last time I checked it was possible to login using the new "Chrome runtime" mode but it's still in experimental state and that mode hasn't improved in the last months.
The code in the OAuth2Tester demo should be enough to authenticate using OAuth2 but I haven't tried to use the access token recently.
This is a real problem for CEF developers but also for WebView2 developers. Google is blocking everyone.
Last time I checked it was possible to login using the new "Chrome runtime" mode but it's still in experimental state and that mode hasn't improved in the last months.
The code in the OAuth2Tester demo should be enough to authenticate using OAuth2 but I haven't tried to use the access token recently.
This is a real problem for CEF developers but also for WebView2 developers. Google is blocking everyone.
Re: Can't login on Google
To solve this problem, replace the useragent with any other non chromium, I usually replace it during the request for accounts.google.com and immediately there is no mistake with security.
-
- Posts: 513
- Joined: Thu Aug 10, 2017 12:40 pm
Re: Can't login on Google
This is what i've been doing for the last year. First i used a Firefox user agent , worked, but then after a while, blocked. Then i switch to Safari, worked and after a while, blocked too. Tried other user agents, but no lucky.Student wrote: Thu Jan 27, 2022 9:33 am To solve this problem, replace the useragent with any other non chromium, I usually replace it during the request for accounts.google.com and immediately there is no mistake with security.
There are SOME logins that will work, but it's getting more and more often that a lot of logins are being blocked

But i set the user agent using GlobalCEFApp. Maybe the way you are doing works, could you please show some code sample ?
-
- Posts: 513
- Joined: Thu Aug 10, 2017 12:40 pm
Re: Can't login on Google
I'm trying to avoid using OAuth because it's a hassle... and of course, once they know the user is logging using your app, of course they will monitore your app's activity and even over time they will try to charge the app creator in some way. A web browser should be free and privatesalvadordf wrote: Wed Jan 26, 2022 7:16 pm Sadly, I don't have any new information about this.
Last time I checked it was possible to login using the new "Chrome runtime" mode but it's still in experimental state and that mode hasn't improved in the last months.
The code in the OAuth2Tester demo should be enough to authenticate using OAuth2 but I haven't tried to use the access token recently.
This is a real problem for CEF developers but also for WebView2 developers. Google is blocking everyone.

But unfortunatelly if there isn't other way, i'll have to follow this OAuth path.
Re: Can't login on Google
in BeforeResourceLoad add checking codethefunkyjoint wrote: Thu Jan 27, 2022 11:43 amThis is what i've been doing for the last year. First i used a Firefox user agent , worked, but then after a while, blocked. Then i switch to Safari, worked and after a while, blocked too. Tried other user agents, but no lucky.Student wrote: Thu Jan 27, 2022 9:33 am To solve this problem, replace the useragent with any other non chromium, I usually replace it during the request for accounts.google.com and immediately there is no mistake with security.
There are SOME logins that will work, but it's getting more and more often that a lot of logins are being blocked
But i set the user agent using GlobalCEFApp. Maybe the way you are doing works, could you please show some code sample ?
Code: Select all
var oldHeader, newHeader: ICefStringMultimap;
i:integer;
if pos('https://accounts.google.com', request.URL) = 1
then
begin
oldHeader := TCefStringMultimapOwn.Create;
newHeader := TCefStringMultimapOwn.Create;
request.GetHeaderMap(oldHeader);
for i := 0 to oldHeader.size - 1 do
begin
if oldHeader.Key[i] = 'User-Agent' then
newHeader.append('User-Agent', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:95.0) Gecko/20100101 RandomString/95.0')
else
newHeader.append(oldHeader.Key[i], oldHeader.Value[i]);
end;
request.SetHeaderMap(newHeader);
oldHeader := nil;
newHeader := nil;
end;
sometimes it gives an error about the insecurity of the browser, I press the back button and repeat the login and the security check passes.
-
- Posts: 513
- Joined: Thu Aug 10, 2017 12:40 pm
Re: Can't login on Google
Thanks , will try that.
But one thing i already noticed with this procedure is, sometimes it won't work and the site will respect the useragent defined on GlobalCefApp. For instance, if you leave GlobalCefApp.userAgent blank, but send an Iphone Safari's user agent on this method, google.com will not show the mobile version instead of desktop. Don't know really why this happens...
But one thing i already noticed with this procedure is, sometimes it won't work and the site will respect the useragent defined on GlobalCefApp. For instance, if you leave GlobalCefApp.userAgent blank, but send an Iphone Safari's user agent on this method, google.com will not show the mobile version instead of desktop. Don't know really why this happens...
Re: Can't login on Google
To control the display of the site, you may need to pass additional headers, for example, set under the mobile screen like thisthefunkyjoint wrote: Fri Jan 28, 2022 12:07 pm Thanks , will try that.
But one thing i already noticed with this procedure is, sometimes it won't work and the site will respect the useragent defined on GlobalCefApp. For instance, if you leave GlobalCefApp.userAgent blank, but send an Iphone Safari's user agent on this method, google.com will not show the mobile version instead of desktop. Don't know really why this happens...
Sec-CH-UA-Mobile: ?1
-
- Posts: 513
- Joined: Thu Aug 10, 2017 12:40 pm
Re: Can't login on Google
One thing i did not understand : if you are already setting the username in GlobalCefApp, why would you have to put it again on BeforeResourceLoad ? This doesn't make sense...