Humm, that is not directly supported because the service worker is intentionally is only ever served with an unauthenticated response. This was implemented as part of the following PR for various reasons: https://github.com/GoogleChromeLabs/pwa-wp/pull/279
However, it can still be possible. What it would likely look like is:
1. When serving a regular page, collect the list of URLs that should be cached for the currently-authenticated user.
2. Send a message to the service worker with the list of these URLs.
3. Register logic in the service worker to listen for this message.
4. For each URL received, fetch it and cache the result using the warm strategy cache approach. (However instead of install
event, you’d be listening to the message
event. Also, you’d want to only do requests for URLs not already cached.)