Page 1 of 1

Cookies on the new version

Posted: Mon Apr 19, 2021 1:01 pm
by thefunkyjoint
Hello,

It seems there was some change on the cookies management on the latest version ; TCefRequestContextRef.New has new parameters.

But even if i use this :

TCefRequestContextRef.New(cookiesdir, '', '', True, False, False, False);

The cookies are not being loaded ; i was logged in a site and now after update, i'm not logged anymore, even using the correct cookiesdir.

What should i do ?

Thanks

Re: Cookies on the new version

Posted: Mon Apr 19, 2021 1:04 pm
by thefunkyjoint
I've made some tests and it seems like i need this :

TCefRequestContextRef.New(cookiesdir, '', '', False, False, False, False);

The first boolean parameter should be False, is that right ?

Thanks

Re: Cookies on the new version

Posted: Mon Apr 19, 2021 1:11 pm
by salvadordf
:oops: :oops: :oops: :oops: :oops:
I think you're right about that parameter.

Please, test it with a FALSE value and I'll update the repository as soon as I can.

Re: Cookies on the new version

Posted: Mon Apr 19, 2021 1:16 pm
by thefunkyjoint
Yes, with FALSE the looks like the cookies are being loaded correctly. I'll test more and report here the results.

Re: Cookies on the new version

Posted: Mon Apr 19, 2021 1:21 pm
by thefunkyjoint
Something is strange... i've tested on www.twitter.com. Logged on my account, closed the app. When opening the app again, i'm not logged anymore. Looks like something is missing on the cookies management.

Re: Cookies on the new version

Posted: Mon Apr 19, 2021 2:34 pm
by salvadordf
I just uploaded your fix. Thanks!!! :D

I did some tests and the twitter session was still open the next time I run the demo.

CEF 90 changed the browser creation sequence and the official cef sample application only creates the browser when the request context is fully initialized.

I need to test this more...

Re: Cookies on the new version

Posted: Tue Apr 20, 2021 8:54 am
by salvadordf
I've been testing the cookies with the MDIBrowser and MDIExternalPumpBrowser demos. I modified them to use a fixed cache directory when you select the Create a new request context for new browsers box.

They worked perfectly and the Twitter sessions were still open when I run them several times.

I even opened the Cookies file inside the cache directory with "SQLite Expert Personal" and the twitter cookies were saved correctly.

Please, check the values in the GlobalCEFApp.RootCache and GlobalCEFApp.Cache properties.

GlobalCEFApp.RootCache must be the parent directory of GlobalCEFApp.Cache and all other cache directories used by browsers with custom request contexts.

Also check that the LocalPrefs.json file is inside the GlobalCEFApp.RootCache directory. This file is extremely important because it has a decryption key to read the cookies.

If the application can't find LocalPrefs.json then it will not be able to read the cookies.

Re: Cookies on the new version

Posted: Tue Apr 20, 2021 12:11 pm
by thefunkyjoint
The first time i tested it did not work, but it seems to be working perfectly now. I'll will monitore and keep you posted. Thank you ! :D