@axa-fr/oidc-client 7.7.3 → 7.9.0-alpha.1110

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/README.md CHANGED
@@ -119,6 +119,9 @@ export const configuration = {
119
119
  const href = window.location.href;
120
120
  const oidcClient = OidcClient.getOrCreate()(configuration);
121
121
 
122
+ // Use the fetch bellow to inject access_token and DPOP tokens automatically
123
+ const oidcFetch = oidcClient.fetchWithTokens(fetch);
124
+
122
125
  // You can inject you own fetch (default Fetch Interface) function and location object (respecting IOidcLocation interface)
123
126
  // import {OidcLocation} from '@axa-fr/oidc-client'
124
127
  // const oidcClient = OidcClient.getOrCreate(() => fetch, new OidcLocation())(configuration);
@@ -190,7 +193,9 @@ const configuration = {
190
193
  },
191
194
  refresh_time_before_tokens_expiration_in_second: Number, // default is 120 seconds
192
195
  service_worker_relative_url: String,
196
+ service_worker_keep_alive_path: String, // default is "/"
193
197
  service_worker_only: Boolean, // default false
198
+ service_worker_activate: () => boolean, // you can take the control of the service worker default activation which use user agent string
194
199
  service_worker_update_require_callback: (registration:any, stopKeepAlive:Function) => Promise<void>, // callback called when service worker need to be updated, you can take the control of the update process
195
200
  extras: StringMap | undefined, // ex: {'prompt': 'consent', 'access_type': 'offline'} list of key/value that is sent to the OIDC server (more info: https://github.com/openid/AppAuth-JS)
196
201
  token_request_extras: StringMap | undefined, // ex: {'prompt': 'consent', 'access_type': 'offline'} list of key/value that is sent to the OIDC server during token request (more info: https://github.com/openid/AppAuth-JS)
@@ -319,6 +324,13 @@ export class OidcClient {
319
324
  */
320
325
  async getValidTokenAsync(waitMs = 200, numberWait = 50): Promise<ValidToken>;
321
326
 
327
+ /**
328
+ * Retrieves a new fetch function that inject bearer tokens (also DPOP tokens).
329
+ * @param fetch The current fetch function to use
330
+ * @returns Fetch A new fectch function that inject bearer tokens (also DPOP tokens).
331
+ */
332
+ fetchWithTokens(fetch: Fetch): Fetch;
333
+
322
334
  /**
323
335
  * Retrieves OIDC user information.
324
336
  * @param noCache Indicates whether user information should be retrieved bypassing the cache.
@@ -0,0 +1,3 @@
1
+ import { Fetch } from "./types";
2
+ import { OidcClient } from "./oidcClient";
3
+ export declare const fetchWithTokens: (fetch: Fetch, oidcClient: OidcClient | null) => (input: URL | RequestInfo, init?: RequestInit) => Promise<Response>;