Page 1 of 1

Import cookies in JSON format

Posted: Mon Jul 10, 2023 4:51 pm
by thefunkyjoint
There is a Chrome extension called 'Cookie editor'. With this i can navigate for instance, to www.Facebook.com and export the cookies of my logged session in JSON format.

Is there a way to import these cookies , so my CEF4Delphi application can be automatically logged on the same session ? This would be a great feature and would avoid the need to log on the same site you are already logged in Google Chrome.

PS : Or even better, is there a way to read Google Chromes directly and import them for our CEF4Delphi app ?

Re: Import cookies in JSON format

Posted: Tue Jul 11, 2023 9:00 am
by salvadordf
Hi,

The CookieVisitor demo is capable of adding cookies manually but CEF doesn't have any API method to read the cookies from Chrome.

If the JSON file has all the unencrypted cookie values then you can use the code in CookieVisitor to import them after reading the JSON contents like this :
https://stackoverflow.com/questions/4350886/how-to-parse-a-json-string-in-delphi

Re: Import cookies in JSON format

Posted: Tue Jul 11, 2023 4:26 pm
by thefunkyjoint
Thanks, i'll have a look on the demo.