I'm trying to use Chromium DevTools protocol in CEF, more precisely the "Network.deleteCookies" method: https://chromedevtools.github.io/devtools-protocol/tot/Network/#method-clearBrowserCookies
1.First I upload stackoverflow.com
and I log in on it and close the site.
2.Then I upload again stackoverflow.com
and I see that I am logged in automatically, that is, Chromium has sent authorization cookies.
3.Now I'm uploading again stackoverflow.com BUT now I want to delete cookies using DevTools protocol, for this before Chromium sends the first request to stackoverflow.com - I'm calling DevTools method "Network.getCookies".
I get all the cookie data that is stored in the cookie cache for stackoverflow.com
:
{"cookies":[{"name":"_ym_isad","value":"2","domain":".stackoverflow.com","path":"/","expires":1656592856,"size":9,"httpOnly":false,"secure":true,"session":false,"sameSite":"None","priority":"Medium","sameParty":false,"sourceScheme":"Secure","sourcePort":443},{"name":"_ym_uid","value":"1656511499689981928","domain":".stackoverflow.com","path":"/","expires":1688056856,"size":26,"httpOnly":false,"secure":true,"session":false,"sameSite":"None","priority":"Medium","sameParty":false,"sourceScheme":"Secure","sourcePort":443},...
I won't copy the entire json message- it's just that it's big. But, I have filtered out all the cookie names:
_ym_isad
_ym_uid
acct
OptanonConsent
_gid
_ym_d
__gpi
__gads
_ga
prov
Next I call DevTools method "Network.deleteCookies" for each cookie name:
the resulting Json code of the "Network.deleteCookies" method call is as follows:
{"id":13,"method":"Network.deleteCookies","params":{"name":"_ym_isad","url":"https://www.stackoverflow.com"}}
{"id":14,"method":"Network.deleteCookies","params":{"name":"_ym_uid","url":"https://www.stackoverflow.com"}}
{"id":15,"method":"Network.deleteCookies","params":{"name":"acct","url":"https://www.ru.stackoverflow.com"}}
{"id":16,"method":"Network.deleteCookies","params":{"name":"OptanonConsent","url":"https://www.stackoverflow.com"}}
{"id":17,"method":"Network.deleteCookies","params":{"name":"_gid","url":"https://www.stackoverflow.com"}}
{"id":18,"method":"Network.deleteCookies","params":{"name":"_ym_d","url":"https://www.stackoverflow.com"}}
{"id":19,"method":"Network.deleteCookies","params":{"name":"__gpi","url":"https://www.stackoverflow.com"}}
{"id":20,"method":"Network.deleteCookies","params":{"name":"__gads","url":"https://www.stackoverflow.com"}}
{"id":21,"method":"Network.deleteCookies","params":{"name":"_ga","url":"https://www.stackoverflow.com"}}
{"id":22,"method":"Network.deleteCookies","params":{"name":"prov","url":"https://www.stackoverflow.com"}}
4.Next, a message comes from DevTools for each call to "Network.deleteCookies":
{"id":3,"result":{}}
That is, the method completed successfully without errors.
HOWEVER, the cookies have not been deleted, and CEF/Chromium sends these cookies to the server.
What's wrong? DevTools "Network.deleteCookies" method - doesn't work ?