Logout: Cookies and service worker

Created on 8 May 2024, 8 months ago
Updated 13 May 2024, 8 months ago

Problem/Motivation

During the logout event, the cookies and services remain active in the browser, which causes errors during the subsequent login event.

Steps to reproduce

1. Install and configure the module.
2. Log in to the site (not with an admin role).
3. Log out.
4. In the browser developer tools, the web worker remains active.
5. Open a new browser window and navigate to the site.
6. The site appears not to have been logged out; the front-end still loads as an authenticated user (cached version).

Proposed resolution

I'm aware that this issue might be related to another module but seems to be a similar situation:
https://www.drupal.org/project/pwa/issues/3279305 ๐Ÿ› Log in / log out problems in Chrome Fixed

IA Quote

https://chat.openai.com/share/7d56aecf-8a7f-43ad-87cf-5da9d2fd7af5

๐Ÿ› Bug report
Status

Closed: duplicate

Version

1.5

Component

Code

Created by

๐Ÿ‡จ๐Ÿ‡ดColombia Freddy Rodriguez Bogotรก

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @Freddy Rodriguez
  • ๐Ÿ‡จ๐Ÿ‡ดColombia Freddy Rodriguez Bogotรก
  • ๐Ÿ‡ฌ๐Ÿ‡งUnited Kingdom gMaximus

    So the first thing is that offline viewing isn't complete for this module. I'm in the process of releasing two supporting modules that integrate rules and flag for push notifications. At that point I'll update this module's page with more info on this.

    I then plan to work on the device caching. For now this patch should resolve the issue. It does for me.

    The offline caching for other pages is already commented out. See line 49 in js/service_worker.js. If you uncomment it, the device caching will work but it needs completing. It's doable on websites where people don't sign into the website. Like your experience here, the cache becomes stale on log in and log out.

    I'm going to make an issue where anyone can help move that along. There is a lot of code in the module for it. I've researched passing drupalSettings to the service worker. That needs developing. The first thing I want is a on/off switch for device caching. For my websites, I want to rely on Drupal's caching and am not interested in offline viewing. My excitement was push notifications. My site is an online community.

  • ๐Ÿ‡ฌ๐Ÿ‡งUnited Kingdom gMaximus

    Wrong patch - sorry!

  • ๐Ÿ‡ฌ๐Ÿ‡งUnited Kingdom gMaximus

    I'd like the device caching to work like this.

    - option to turn off and on.
    - on login/logout, the device cache should be cleared.
    - option to configure what gets cached. I envisage the setting to be like configuring a block.

    Can you pls send me a English version of that AI link?

  • ๐Ÿ‡ฌ๐Ÿ‡งUnited Kingdom gMaximus

    @Freddy Rodriguez. I've done a lot of work on the service worker over the last couple of days. With this patch, the device cache is cleared on login and logout. On logout, the page will refresh after the device cache is cleared, it makes the page feel like it lags and I'd love any ideas for how to do it differently. I was frankly losing the will.

    I now know how to start passing variables to the service worker. So I feel that page caching settings is not to far off.

    If you can, pls test and let me know how you get on.

  • Status changed to Closed: duplicate 8 months ago
  • ๐Ÿ‡ฌ๐Ÿ‡งUnited Kingdom gMaximus

    I'm closing this now. The solution for this is in that issue fork.

    I've also developed a little more in order to unregister the client-side service worker after uninstalling this module.

    Any help you can give testing would be greatly appreciated.

Production build 0.71.5 2024