0
votes

Basically this issue: https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/17360912/

Service Worker: Credentials are not sent during registration
Author: Yannick S.
Created: May 3, 2018

When registering a service worker with navigator.serviceWorker.register('service-worker.js') in an authenticated scenario, the request to fetch the service worker omits the Authorization header with the credentials, resulting in a 401 error. (Other browsers send credentials when fetching service workers.) The promise returned by register is rejected with TypeError: invalid argument.

This seems to also apply to Chrome and Firefox, I don't see the Authorization header in the request. There is an option for register(file, { scope }) but only for specifying service worker scope.

Is there an option like for links to pass credentials?
<link crossorigin="use-credentials">

1
Did you end up finding a fix for this?Arnaud H

1 Answers

0
votes

What does your "fetch" look like?

Try adding: -

credentials: "same-origin", // include, *same-origin, omit

as per fetch docs