@bytescale/sdk 3.14.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.
package/dist/browser/cjs/main.js
CHANGED
|
@@ -2600,8 +2600,8 @@ var AuthManagerImpl = /*#__PURE__*/function () {
|
|
|
2600
2600
|
return AuthManagerBrowser_await(_this6.setAccessToken(session.params, jwt), function (setTokenResult) {
|
|
2601
2601
|
_this6.setServiceWorkerConfig(session, [{
|
|
2602
2602
|
headers: [{
|
|
2603
|
-
key: "Authorization
|
|
2604
|
-
value: jwt
|
|
2603
|
+
key: "Authorization",
|
|
2604
|
+
value: "Bearer ".concat(jwt)
|
|
2605
2605
|
}],
|
|
2606
2606
|
expires: Date.now() + setTokenResult.ttlSeconds * 1000,
|
|
2607
2607
|
urlPrefix: "".concat(_this6.getCdnUrl(session.params), "/").concat(session.params.accountId, "/")
|
|
@@ -2585,8 +2585,8 @@ var AuthManagerImpl = /*#__PURE__*/function () {
|
|
|
2585
2585
|
return AuthManagerBrowser_await(_this6.setAccessToken(session.params, jwt), function (setTokenResult) {
|
|
2586
2586
|
_this6.setServiceWorkerConfig(session, [{
|
|
2587
2587
|
headers: [{
|
|
2588
|
-
key: "Authorization
|
|
2589
|
-
value: jwt
|
|
2588
|
+
key: "Authorization",
|
|
2589
|
+
value: "Bearer ".concat(jwt)
|
|
2590
2590
|
}],
|
|
2591
2591
|
expires: Date.now() + setTokenResult.ttlSeconds * 1000,
|
|
2592
2592
|
urlPrefix: "".concat(_this6.getCdnUrl(session.params), "/").concat(session.params.accountId, "/")
|
|
@@ -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:
|