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.
If you find these projects useful please consider becoming a sponsor with Patreon, GitHub or Liberapay.

Logged sites gone after update to 128

thefunkyjoint
Posts: 513
Joined: Thu Aug 10, 2017 12:40 pm

Logged sites gone after update to 128

Post by thefunkyjoint »

Hello,

Today i updated to Chromium 128 and the newest CEF4Delphi version.

I noticed that all my logged websites, logged out.

There is a change on TCefRequestContextRef.New, maybe it's related to this ?

I'd like to the websites stay logged, so far everything stays logged after Chromium updates, until this one :shock:

Here is how i'm using :

Code: Select all

TempContext := TCefRequestContextRef.New('c:\mycookiesdir', '', '', False, false, ReqContextHandler) ;
The folder 'c:\mycookiesdir' contains logged cookies from the websites, but even so, when i open Instagram, for instance, it's logged out.
User avatar
salvadordf
Posts: 4564
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: Logged sites gone after update to 128

Post by salvadordf »

Perhaps there's an issue with the GlobalCEFApp.cache and GlobalCEFApp.RootCache values.

Set GlobalCEFApp.RootCache to a directory and GlobalCEFApp.cache to a subdirectory inside GlobalCEFApp.RootCache. For example :

Code: Select all

GlobalCEFApp.RootCache := 'c:\myrootdir';
GlobalCEFApp.Cache := 'c:\myrootdir\cache';
For independent browsers use :

Code: Select all

TempContext := TCefRequestContextRef.New('c:\myrootdir\cache2', '', '', False, false, ReqContextHandler) ;
thefunkyjoint
Posts: 513
Joined: Thu Aug 10, 2017 12:40 pm

Re: Logged sites gone after update to 128

Post by thefunkyjoint »

salvadordf wrote: Wed Sep 04, 2024 12:02 pm Perhaps there's an issue with the GlobalCEFApp.cache and GlobalCEFApp.RootCache values.

Set GlobalCEFApp.RootCache to a directory and GlobalCEFApp.cache to a subdirectory inside GlobalCEFApp.RootCache. For example :

Code: Select all

GlobalCEFApp.RootCache := 'c:\myrootdir';
GlobalCEFApp.Cache := 'c:\myrootdir\cache';
For independent browsers use :

Code: Select all

TempContext := TCefRequestContextRef.New('c:\myrootdir\cache2', '', '', False, false, ReqContextHandler) ;
Yes, it's already configured this way, and i did not change anything on my code ; so far, until 127 the websites always stay logged, just on this new update this issue happened.

Do i need to configure something on ReqContextHandler ?
User avatar
salvadordf
Posts: 4564
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: Logged sites gone after update to 128

Post by salvadordf »

I'm not aware of any other code change regarding the cache.

The last updated removed the GlobalCEFApp.PersistUserPreferences property and the PersistUserPreferences parameter when you create the request context because CEF removed it from the settings. I'm not sure what would Chromium do to the cookies if some application set PersistUserPreferences to true in the previous version.

Try logging in again, close the application and see is the user remains logged in the second time the app is running.
thefunkyjoint
Posts: 513
Joined: Thu Aug 10, 2017 12:40 pm

Re: Logged sites gone after update to 128

Post by thefunkyjoint »

salvadordf wrote: Wed Sep 04, 2024 12:39 pm I'm not aware of any other code change regarding the cache.

The last updated removed the GlobalCEFApp.PersistUserPreferences property and the PersistUserPreferences parameter when you create the request context because CEF removed it from the settings. I'm not sure what would Chromium do to the cookies if some application set PersistUserPreferences to true in the previous version.

Try logging in again, close the application and see is the user remains logged in the second time the app is running.
The problem is, if all websites log out after 128, it will be a headache because all customers that update my app, will loose the login cookies... a lot of people have 2-factor auth and will need to send SMS to log again :?

You can simulate the problem by doing this :

1 - Rollback to 127
2 - Go on any social network (Facebook , Instagram etc), log in .
3 - Close the browser
4 - Update to 128
5 - Open the browser : it will be logged out

There is something wrong, i don't know if it's related to CEF4Delphi or CEF ; will do further tests.
User avatar
salvadordf
Posts: 4564
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: Logged sites gone after update to 128

Post by salvadordf »

Try to reproduce this issue in cefclient. This looks like an upstream issue.
thefunkyjoint
Posts: 513
Joined: Thu Aug 10, 2017 12:40 pm

Re: Logged sites gone after update to 128

Post by thefunkyjoint »

This is what they told me on CEF support board :

"Chrome runtime is enabled by default and uses a different Profile directory. See https://github.com/chromiumembedded/cef/issues/3685"

Is there anything we can do to keep cookies / session ?

:?
sodlf159
Posts: 90
Joined: Thu Nov 09, 2023 1:55 pm

답글: 128로 업데이트한 후 사라진 로그인 사이트

Post by sodlf159 »

The sessions are different.
We recommend that you reuse Chrome 127.
thefunkyjoint
Posts: 513
Joined: Thu Aug 10, 2017 12:40 pm

Re: Logged sites gone after update to 128

Post by thefunkyjoint »

Ok, i already understood that a re-login will be needed after this update, no workarounds.
User avatar
salvadordf
Posts: 4564
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: Logged sites gone after update to 128

Post by salvadordf »

All the applications that didn't migrate to Chrome runtime are now forced to use it.

You can still select the style with TChromiumCore.RuntimeStyle to CEF_RUNTIME_STYLE_ALLOY but if the application uses JavaScript integration you'll need to use the default TChromiumCore.RuntimeStyle value which uses Chrome style in most cases.

For off-screen browsers the default value is CEF_RUNTIME_STYLE_ALLOY but for the rest is CEF_RUNTIME_STYLE_CHROME.

This is the documentation for TCefRuntimeStyle :

Code: Select all

  /// CEF supports both a Chrome runtime style (based on the Chrome UI layer) and
  /// an Alloy runtime style (based on the Chromium content layer). Chrome style
  /// provides the full Chrome UI and browser functionality whereas Alloy style
  /// provides less default browser functionality but adds additional client
  /// callbacks and support for windowless (off-screen) rendering. The style type
  /// is individually configured for each window/browser at creation time and
  /// different styles can be mixed during runtime. For additional comparative
  /// details on runtime styles see
  /// https://bitbucket.org/chromiumembedded/cef/wiki/Architecture.md#markdown-header-cef3
  ///
  /// Windowless rendering will always use Alloy style. Windowed rendering with a
  /// default window or client-provided parent window can configure the style via
  /// TCefWindowInfo.runtime_style. Windowed rendering with the Views framework can
  /// configure the style via ICefWindowDelegate.GetWindowRuntimeStyle and
  /// ICefBrowserViewDelegate.GetBrowserRuntimeStyle. Alloy style Windows with the
  /// Views framework can host only Alloy style BrowserViews but Chrome style
  /// Windows can host both style BrowserViews. Additionally, a Chrome style
  /// Window can host at most one Chrome style BrowserView but potentially
  /// multiple Alloy style BrowserViews. See TCefWindowInfo.runtime_style
  /// documentation for any additional platform-specific limitations.
As the CEF project maintainer said, the Chrome runtime different Profile directory and that means that it has many changes in the cache directory.

Try migrating the contents as described by EamonHetherton in the last message of this issue :
https://github.com/chromiumembedded/cef/issues/3721
  • Run the Alloy bootstrap and ensure some cookies exist.
  • Create a "Default" directory in the cache folder.
  • Copy the "Local Storage", "Session Storage" and "Network" folders to the sub folder "Default" (maybe should copy some other folders too, have not investigated further yet)
  • Rename "LocalPrefs.json" in cache directory to "Local State" (this is essentially setting up the correct os_crypt.encrypted_key value that can be used to decrypt the cookie values)
Post Reply