ServiceWorkerOptions
Index
Properties
optionalreadonlyapiUrl
Narrows where the worker adds the session's token. Defaults to the session's origin, which covers every service; set it to a URL under that origin, such as one service's, to cover less.
Either way only API requests get the token: those whose path goes through /_ps/, which is how
every Twinfinity service is reached. That keeps it off everything else on the origin: the
identity provider, whose token endpoint may refuse a bearer header it never asked for, the
applications' own files, and SharePoint behind the gateway. The boundary is a whole path segment,
and a leading bim. on the host is not significant, as for the session's origin.
Must be on the session's origin, since that is where the session's tokens are accepted.
apiUrl rides on the worker's script URL, so an app whose own pages pass different values
would have its tabs fight over which one the worker uses; the default avoids this since every
caller sends the same value.
optionalreadonlyscope
Passed to ServiceWorkerContainer.register. Defaults to the directory of the script.
optionalreadonlyscriptUrl
The worker script. Defaults to the prebuilt worker, twinfinity-authentication-sw.js resolved
against document.baseURI, which the application serves by copying
dist/twinfinity-authentication-sw.js from this package next to its own served index.html —
see TwinfinitySession.registerServiceWorker. Set it to use a worker of the
application's own, which then calls installServiceWorkerAuthorization from
@twinfinity/authentication/service-worker. A relative value is resolved the same way.
optionalreadonlytype
Passed to ServiceWorkerContainer.register. 'module' when the worker script is an ES module;
the prebuilt worker is a classic script, so leave it unset for that.
Options for TwinfinitySession.registerServiceWorker.