@thunderid/browser 1.9.1 → 1.9.2

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
@@ -1,6 +1,6 @@
1
1
  import { Buffer } from 'buffer/index.js';
2
2
  if (typeof window !== 'undefined' && !window.Buffer) { window.Buffer = Buffer; }
3
- import { DEFAULT_THEME, HttpClient, OIDCRequestConstants, ThunderIDAuthException, ThunderIDJavaScriptClient, ThunderIDRuntimeError, TokenConstants, arrayBufferToBase64url, base64urlToArrayBuffer, createPackageComponentLogger, extractEmojiFromUri, extractPkceStorageKeyFromState, generateFlattenedUserProfile, getTokenPermissions, getUsersMe, isEmojiUri, resolveBackendEndpoints, resolveResourceEndpoint } from "@thunderid/javascript";
3
+ import { DEFAULT_THEME, HttpClient, OIDCRequestConstants, ThunderIDAuthException, ThunderIDJavaScriptClient, ThunderIDRuntimeError, TokenConstants, arrayBufferToBase64url, base64urlToArrayBuffer, createPackageComponentLogger, extractEmojiFromUri, extractPkceStorageKeyFromState, generateFlattenedUserProfile, getTokenPermissions, getUsersMe, isEmojiUri, resolveApiBaseUrl, resolveBackendEndpoints, resolveResourceEndpoint } from "@thunderid/javascript";
4
4
  import base64url from "base64url";
5
5
  import sha256 from "fast-sha256";
6
6
  import { createLocalJWKSet, jwtVerify } from "jose";
@@ -220,11 +220,12 @@ var BackendClient = class BackendClient {
220
220
  return await response.json();
221
221
  }
222
222
  /**
223
- * The headers and credentials mode every backend request is sent with.
223
+ * The headers and credentials mode every backend request is sent with. The cookies go with every
224
+ * request, so a backend on another origin works too when its CORS allows credentials.
224
225
  */
225
226
  static requestInit(headers = {}) {
226
227
  return {
227
- credentials: "same-origin",
228
+ credentials: "include",
228
229
  headers: {
229
230
  ...headers,
230
231
  [BACKEND_REQUEST_HEADER]: BACKEND_REQUEST_HEADER_VALUE
@@ -3083,7 +3084,7 @@ var ThunderIDBrowserClient = class ThunderIDBrowserClient extends ThunderIDJavaS
3083
3084
  await this._validateMethod();
3084
3085
  const configData = await this.getStorageManager().getConfigData();
3085
3086
  const profile = await getUsersMe({
3086
- baseUrl: options?.baseUrl ?? configData?.baseUrl,
3087
+ baseUrl: options?.baseUrl ?? resolveApiBaseUrl(configData),
3087
3088
  fetcher: createHttpClientFetcher_default(this._browserInstanceId),
3088
3089
  url: resolveResourceEndpoint("usersMe", configData, options?.url)
3089
3090
  });