Why do Chromium and Chrome delete all cookies after closing the browser

cookiesgoogle-chromeweb-browsing

I am unable to stay signed in on Chromium and Google Chrome. I sign in to website A, close all tabs, open website A again, and am still signed in. I quit Chromium or Google Chrome, open website A, and have to sign in again.

I believe the problem is from Chromium because I can stay signed in on website A on other browsers. I checked this thread and confirm that at chrome://settings/content/cookies, I have disabled Clear cookies and site data when you quit Chrome. That issue seems to continue unsolved.

I am using Chrome 81.0.4044.138 and Chromium 766739.

How can I stay signed in on a website with Chromium or Chrome?

Update: I reinstalled Chromium and Google Chrome and have the same problem. I have since learned how to inspect cookies. On Facebook, for example, I have cookies that expire in 3 months:

cookies before quitting browser

After I quit and restart Chromium, all cookies from facebook are gone:

no cookies after quitting browser

Another problem that could be related is that each time I launch Chromium or Chrome, I get these two alerts, as if I were launching it for the first time:

alert about incoming network connections

alert about keychain access

I believe this is a problem with the browser on this operating system because of these two alerts, and because Brave which is also based on Chromium does not give these problems.

And for reference, my settings do not ask to clear cookies after restarting:

cookie settings

Second update: I updated Chromium (Version 86.0.4207.0 (Developer Build) (64-bit), 18 July 2020) and Google Chrome (Version 84.0.4147.105 (Official Build) (64-bit), 18 July 2020) and they both have the same problem. I verify that cookies are enabled, sign in to a website, quit the browser, go to the same website, and I am signed out, even though the website has cookies stored. Here is an example of cookies from StackOverflow saved on the browser, which looks the same for Chromium and Chrome:

saved cookies

Note: Moved to SuperUser.

Best Answer

Session Cookies vs. Persistent Cookies

When creating a cookie, the code has the option of setting an expiration date & time. If this is done, then that cookie is persisted to storage on the client's web browser (e.g. it writes it to a cookie file ... the specific name for that file will vary based on which web browser is being used.)

If a cookie is created without setting an expiration time, then that cookie is a "session" cookie. It will not be stored in any file. It will only be stored in the web browser's process memory and will be dropped when that process ends.

See https://en.wikipedia.org/wiki/HTTP_cookie

Note there's some loose language in that Wikipedia article. A single browser process (any browser... Chrome, Chromium, Safari, Firefox, etc.) can have multiple windows and multiple tabs per window. Session cookies are only dropped when the browser process terminates ... not when the tab is closed. Most browser don't lock cookies to a specific window or tab (though there have been exceptions.) This means usually you can close a window or tab ... then re-open a new window or tab (as long as you didn't completely exit the browser) and return to a page without having to create a new session cookie.

Caveats

Cookies dealing with user sessions usually wont have an expiration time (making them "session" cookies) but the server session itself may have other attributes which track the maximum length of the session.

It is somewhat common for hosted applications to save the session creation time as well as the session idle time ... and set maximum elapsed times for those. This varies depending on the application -- it is not based on any standard. But the net effect is that just because your browser still has a cookie, doesn't mean a server will honor the cookie.