No more login to Google Drive in TWebBrowser: "this browser or app may not be secure."

Viewed 231

Our app uses the TWebBrowser control from Delphi 10.1 and tries to login to Google Drive using the OAuth2 method (REST.Authenticator.OAuth.WebForm.Win). That worked fine for years.

Now Google obviously considers the TWebBrowser control outdated, giving the message: "This browser or app may not be secure."

I have tried the following potential remedies:

  1. Setting FEATURE_BROWSER_EMULATION in the registry (works for Google maps)

  2. Setting the global session header in the REST FormCreate event:

    UserAgent:= 'User-Agent: Chrome/96.0.4664.93';
    UrlMkSetSessionOption(URLMON_OPTION_USERAGENT, Pchar(UserAgent), Length(UserAgent), 0);
    
  3. WebBrowser.Navigate(URL, null, null, null, 'User-Agent: Chrome/96.0.4664.93');

None of them work. Did I do something wrong, is there another option, or has Google decided to outdate my Delphi version? Supposedly, updating to Dephi 11 solves the problem by setting TWebBrowser to use the Chrome engine. But I cannot do that at the moment and need a quicker fix.

1 Answers

Try value 11001 for FEATURE_BROWSER_EMULATION. Works for me in 64bit Windows and Delphi 2006 application using TWebBrowser.

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION]
"Project7.exe"=dword:11001

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION]
"Project7.exe"=dword:11001
Related