@nauth-toolkit/client-angular 0.1.57 → 0.1.59

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.
@@ -24,6 +24,22 @@ import * as i0 from "@angular/core";
24
24
  export declare class AngularHttpAdapter implements HttpAdapter {
25
25
  private readonly http;
26
26
  constructor(http: HttpClient);
27
+ /**
28
+ * Safely parse a JSON response body.
29
+ *
30
+ * Angular's fetch backend (`withFetch()`) will throw a raw `SyntaxError` if
31
+ * `responseType: 'json'` is used and the backend returns HTML (common for
32
+ * proxies, 502 pages, SSR fallbacks, or misrouted requests).
33
+ *
34
+ * To avoid crashing consumer apps, we always request as text and then parse
35
+ * JSON only when the response actually looks like JSON.
36
+ *
37
+ * @param bodyText - Raw response body as text
38
+ * @param contentType - Content-Type header value (if available)
39
+ * @returns Parsed JSON value (unknown)
40
+ * @throws {SyntaxError} When body is non-empty but not valid JSON
41
+ */
42
+ private parseJsonBody;
27
43
  /**
28
44
  * Execute HTTP request using Angular's HttpClient.
29
45
  *
@@ -9,8 +9,8 @@ import { type CanActivateFn } from '@angular/router';
9
9
  * - `error` / `error_description` (provider errors)
10
10
  *
11
11
  * Behavior:
12
- * - If `exchangeToken` exists: exchanges it via backend and redirects to success or challenge routes.
13
- * - If no `exchangeToken`: treat as cookie-success path and redirect to success route.
12
+ * - If `exchangeToken` exists: exchanges it via backend (SDK handles navigation automatically).
13
+ * - If no `exchangeToken`: treat as cookie-success path (SDK handles navigation automatically).
14
14
  * - If `error` exists: redirects to oauthError route.
15
15
  *
16
16
  * @example