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.

Keep multiple sessions

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

Keep multiple sessions

Post by thefunkyjoint »

Hi,

I'm trying to save multiple user sessions in my app. What i want is , the user can fast switch between his logins in a website.

For achieve the results, i'm saving the Cookies files when he logs in the website. When he wants to log with another user, he will logout and login, and then i can save the cookies of this new user with another name. When he wants to switch back to the first login, i recover the first saved cookies file.

But it's not working ; it only works if i save the entire cookies dir (which is about 450 MB), instead of only the Cookies file.

Is there a way to know exactly which files i need to save in order to recover the entire session ?

Thanks
User avatar
salvadordf
Posts: 4565
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: Keep multiple sessions

Post by salvadordf »

Hi,

When you set GlobalCEFApp.DeleteCookies to true, it deletes the "Cookies" and "Cookies-journal" files but I would use another way to switch between users.

There are 2 options :
  • Save the username and passwords for all the users in your application. Let the user click in the logout option in that web page and let the browser manage the cookies. Your application would have to find a way to detect if the current focused HTML element is an input box for the username, show the available usernames and fill the passwords automatically. This is the most complicated option by far.
  • Create a new independent browser with a new request context that uses a different directory for the cache and cookies. Your application would only have to show the available user names and create a browser using the cache directory for that user.
thefunkyjoint
Posts: 513
Joined: Thu Aug 10, 2017 12:40 pm

Re: Keep multiple sessions

Post by thefunkyjoint »

salvadordf wrote: Fri Oct 18, 2019 5:15 pm Hi,

When you set GlobalCEFApp.DeleteCookies to true, it deletes the "Cookies" and "Cookies-journal" files but I would use another way to switch between users.

There are 2 options :
  • Save the username and passwords for all the users in your application. Let the user click in the logout option in that web page and let the browser manage the cookies. Your application would have to find a way to detect if the current focused HTML element is an input box for the username, show the available usernames and fill the passwords automatically. This is the most complicated option by far.
  • Create a new independent browser with a new request context that uses a different directory for the cache and cookies. Your application would only have to show the available user names and create a browser using the cache directory for that user.
Sounds like a good plan, will try that, thanks :D
Post Reply