@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 CHANGED
@@ -205,6 +205,11 @@ var REQUIRE_TOKEN_RETRY_DELAY_MS = 150;
205
205
  function delay(ms) {
206
206
  return new Promise((resolve) => setTimeout(resolve, ms));
207
207
  }
208
+ var USER_TOKEN_HEADER = "X-Truth-Authorization";
209
+ function setUserToken(headers, token) {
210
+ headers.Authorization = `Bearer ${token}`;
211
+ headers[USER_TOKEN_HEADER] = `Bearer ${token}`;
212
+ }
208
213
  function resolveAuthToken(getAuthToken) {
209
214
  return __async(this, null, function* () {
210
215
  try {
@@ -235,7 +240,7 @@ function buildAuthHeaders(auth, options) {
235
240
  for (let attempt = 0; attempt < REQUIRE_TOKEN_MAX_ATTEMPTS; attempt++) {
236
241
  const token = yield resolveAuthToken(auth.getAuthToken);
237
242
  if (token) {
238
- headers.Authorization = `Bearer ${token}`;
243
+ setUserToken(headers, token);
239
244
  return headers;
240
245
  }
241
246
  if (attempt < REQUIRE_TOKEN_MAX_ATTEMPTS - 1) {
@@ -249,7 +254,7 @@ function buildAuthHeaders(auth, options) {
249
254
  if (auth.getAuthToken) {
250
255
  const token = yield resolveAuthToken(auth.getAuthToken);
251
256
  if (token) {
252
- headers.Authorization = `Bearer ${token}`;
257
+ setUserToken(headers, token);
253
258
  }
254
259
  }
255
260
  return headers;