@bytescale/sdk 3.15.0 → 3.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -19,9 +19,11 @@ export interface BeginAuthSessionParams {
|
|
|
19
19
|
*/
|
|
20
20
|
options?: Pick<BytescaleApiClientConfig, "fetchApi" | "cdnUrl">;
|
|
21
21
|
/**
|
|
22
|
-
*
|
|
22
|
+
* Enables support for modern browsers that block third-party cookies (like Safari).
|
|
23
23
|
*
|
|
24
|
-
*
|
|
24
|
+
* The value of this field must be the path to the service worker JavaScript file hosted at the root of your website.
|
|
25
|
+
*
|
|
26
|
+
* OVERVIEW:
|
|
25
27
|
*
|
|
26
28
|
* This feature works by running a "service worker" in the background that adds "Authorization" and "Authorization-Token"
|
|
27
29
|
* request headers to HTTP requests made to the Bytescale CDN. This allows the Bytescale CDN to authorize requests
|
|
@@ -30,21 +32,23 @@ export interface BeginAuthSessionParams {
|
|
|
30
32
|
* to block these cookies, meaning "Authorization" request headers must be used instead. Authorization headers can
|
|
31
33
|
* only be added to requests originating from page elements like "<img>" elements through the use of service workers.
|
|
32
34
|
*
|
|
33
|
-
*
|
|
35
|
+
* INSTRUCTIONS:
|
|
36
|
+
*
|
|
37
|
+
* 1. Your JWT must include the 'accountId' field at the root of the 'payload' section of the JWT (i.e. next to the 'exp' field).
|
|
34
38
|
*
|
|
35
|
-
*
|
|
39
|
+
* 2. Create a JavaScript file that contains the following line:
|
|
36
40
|
*
|
|
37
41
|
* importScripts("https://js.bytescale.com/auth-sw/v1");
|
|
38
42
|
*
|
|
39
|
-
*
|
|
43
|
+
* 3. Host this JavaScript file from your website:
|
|
40
44
|
*
|
|
41
|
-
*
|
|
45
|
+
* 3a. It MUST be under the ROOT directory of your website.
|
|
42
46
|
* (e.g. "/bytescale-auth-sw.js")
|
|
43
47
|
*
|
|
44
|
-
*
|
|
48
|
+
* 3b. It MUST be on the SAME DOMAIN as your website.
|
|
45
49
|
* (e.g. "www.example.com" and not "assets.example.com")
|
|
46
50
|
*
|
|
47
|
-
*
|
|
51
|
+
* 4. Specify the absolute path to your JavaScript file in the 'beginAuthSession' call.
|
|
48
52
|
* (e.g. { ..., serviceWorkerScript: "/bytescale-auth-sw.js" })
|
|
49
53
|
*
|
|
50
54
|
* Examples:
|