@hipnation-truth/sdk 0.26.13 → 0.26.14
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/index.js +7 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +7 -2
- package/dist/index.mjs.map +1 -1
- package/dist/react.js +7 -2
- package/dist/react.js.map +1 -1
- package/package.json +1 -1
package/dist/react.js
CHANGED
|
@@ -239,6 +239,11 @@ var REQUIRE_TOKEN_RETRY_DELAY_MS = 150;
|
|
|
239
239
|
function delay(ms) {
|
|
240
240
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
241
241
|
}
|
|
242
|
+
var USER_TOKEN_HEADER = "X-Truth-Authorization";
|
|
243
|
+
function setUserToken(headers, token) {
|
|
244
|
+
headers.Authorization = `Bearer ${token}`;
|
|
245
|
+
headers[USER_TOKEN_HEADER] = `Bearer ${token}`;
|
|
246
|
+
}
|
|
242
247
|
function resolveAuthToken(getAuthToken) {
|
|
243
248
|
return __async(this, null, function* () {
|
|
244
249
|
try {
|
|
@@ -269,7 +274,7 @@ function buildAuthHeaders(auth, options) {
|
|
|
269
274
|
for (let attempt = 0; attempt < REQUIRE_TOKEN_MAX_ATTEMPTS; attempt++) {
|
|
270
275
|
const token = yield resolveAuthToken(auth.getAuthToken);
|
|
271
276
|
if (token) {
|
|
272
|
-
headers
|
|
277
|
+
setUserToken(headers, token);
|
|
273
278
|
return headers;
|
|
274
279
|
}
|
|
275
280
|
if (attempt < REQUIRE_TOKEN_MAX_ATTEMPTS - 1) {
|
|
@@ -283,7 +288,7 @@ function buildAuthHeaders(auth, options) {
|
|
|
283
288
|
if (auth.getAuthToken) {
|
|
284
289
|
const token = yield resolveAuthToken(auth.getAuthToken);
|
|
285
290
|
if (token) {
|
|
286
|
-
headers
|
|
291
|
+
setUserToken(headers, token);
|
|
287
292
|
}
|
|
288
293
|
}
|
|
289
294
|
return headers;
|