@insforge/sdk 1.3.0-ssr.1 → 1.3.0-ssr.3
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 +31 -1
- package/dist/{client-B8ykVESe.d.mts → client-CQfw9UsO.d.mts} +7 -1
- package/dist/{client-B8ykVESe.d.ts → client-CQfw9UsO.d.ts} +7 -1
- package/dist/index.d.mts +5 -4
- package/dist/index.d.ts +5 -4
- package/dist/index.js +87 -57
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +76 -57
- package/dist/index.mjs.map +1 -1
- package/dist/ssr.d.mts +17 -6
- package/dist/ssr.d.ts +17 -6
- package/dist/ssr.js +122 -91
- package/dist/ssr.js.map +1 -1
- package/dist/ssr.mjs +112 -91
- package/dist/ssr.mjs.map +1 -1
- package/package.json +1 -1
package/dist/ssr.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as InsForgeConfig, I as InsForgeClient,
|
|
1
|
+
import { a as InsForgeConfig, I as InsForgeClient, m as AuthRefreshResponse, e as InsForgeError } from './client-CQfw9UsO.mjs';
|
|
2
2
|
import '@insforge/shared-schemas';
|
|
3
3
|
import '@supabase/postgrest-js';
|
|
4
4
|
|
|
@@ -24,10 +24,21 @@ interface AuthCookieOptions {
|
|
|
24
24
|
type CookieStoreValue = string | {
|
|
25
25
|
value?: string | null;
|
|
26
26
|
} | undefined | null;
|
|
27
|
-
interface
|
|
27
|
+
interface CookieReader {
|
|
28
28
|
get(name: string): CookieStoreValue;
|
|
29
|
+
}
|
|
30
|
+
interface CookieWriter {
|
|
29
31
|
set?(name: string, value: string, options?: CookieOptions): unknown;
|
|
30
|
-
|
|
32
|
+
set?(options: {
|
|
33
|
+
name: string;
|
|
34
|
+
value: string;
|
|
35
|
+
} & CookieOptions): unknown;
|
|
36
|
+
delete?(name: string): unknown;
|
|
37
|
+
delete?(options: {
|
|
38
|
+
name: string;
|
|
39
|
+
} & CookieOptions): unknown;
|
|
40
|
+
}
|
|
41
|
+
interface CookieStore extends CookieReader, CookieWriter {
|
|
31
42
|
}
|
|
32
43
|
interface AuthCookieSettings {
|
|
33
44
|
names?: AuthCookieNames;
|
|
@@ -37,11 +48,11 @@ declare function getAccessTokenCookieName(names?: AuthCookieNames): string;
|
|
|
37
48
|
declare function getRefreshTokenCookieName(names?: AuthCookieNames): string;
|
|
38
49
|
declare function accessTokenCookieOptions(token: string, overrides?: CookieOptions): CookieOptions;
|
|
39
50
|
declare function refreshTokenCookieOptions(token: string, overrides?: CookieOptions): CookieOptions;
|
|
40
|
-
declare function setAuthCookies(
|
|
51
|
+
declare function setAuthCookies(cookies: CookieWriter | undefined, tokens: {
|
|
41
52
|
accessToken: string;
|
|
42
53
|
refreshToken?: string | null;
|
|
43
54
|
}, settings?: AuthCookieSettings): void;
|
|
44
|
-
declare function clearAuthCookies(
|
|
55
|
+
declare function clearAuthCookies(cookies: CookieWriter | undefined, settings?: AuthCookieSettings): void;
|
|
45
56
|
|
|
46
57
|
interface CreateBrowserClientOptions extends Omit<InsForgeConfig, 'edgeFunctionToken' | 'isServerMode' | 'auth'>, AuthCookieSettings {
|
|
47
58
|
refreshUrl?: string;
|
|
@@ -85,4 +96,4 @@ interface UpdateSessionResult {
|
|
|
85
96
|
}
|
|
86
97
|
declare function updateSession(options: UpdateSessionOptions): Promise<UpdateSessionResult>;
|
|
87
98
|
|
|
88
|
-
export { type AuthCookieNames, type AuthCookieOptions, type AuthCookieSettings, type CookieOptions, type CookieStore, type CreateBrowserClientOptions, type CreateServerClientOptions, DEFAULT_ACCESS_TOKEN_COOKIE, DEFAULT_REFRESH_TOKEN_COOKIE, type RefreshAuthOptions, type RefreshAuthResult, type RefreshAuthRouteHandler, type UpdateSessionOptions, type UpdateSessionResult, accessTokenCookieOptions, clearAuthCookies, createBrowserClient, createRefreshAuthRouter, createServerClient, getAccessTokenCookieName, getRefreshTokenCookieName, refreshAuth, refreshTokenCookieOptions, setAuthCookies, updateSession };
|
|
99
|
+
export { type AuthCookieNames, type AuthCookieOptions, type AuthCookieSettings, type CookieOptions, type CookieReader, type CookieStore, type CookieWriter, type CreateBrowserClientOptions, type CreateServerClientOptions, DEFAULT_ACCESS_TOKEN_COOKIE, DEFAULT_REFRESH_TOKEN_COOKIE, type RefreshAuthOptions, type RefreshAuthResult, type RefreshAuthRouteHandler, type UpdateSessionOptions, type UpdateSessionResult, accessTokenCookieOptions, clearAuthCookies, createBrowserClient, createRefreshAuthRouter, createServerClient, getAccessTokenCookieName, getRefreshTokenCookieName, refreshAuth, refreshTokenCookieOptions, setAuthCookies, updateSession };
|
package/dist/ssr.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as InsForgeConfig, I as InsForgeClient,
|
|
1
|
+
import { a as InsForgeConfig, I as InsForgeClient, m as AuthRefreshResponse, e as InsForgeError } from './client-CQfw9UsO.js';
|
|
2
2
|
import '@insforge/shared-schemas';
|
|
3
3
|
import '@supabase/postgrest-js';
|
|
4
4
|
|
|
@@ -24,10 +24,21 @@ interface AuthCookieOptions {
|
|
|
24
24
|
type CookieStoreValue = string | {
|
|
25
25
|
value?: string | null;
|
|
26
26
|
} | undefined | null;
|
|
27
|
-
interface
|
|
27
|
+
interface CookieReader {
|
|
28
28
|
get(name: string): CookieStoreValue;
|
|
29
|
+
}
|
|
30
|
+
interface CookieWriter {
|
|
29
31
|
set?(name: string, value: string, options?: CookieOptions): unknown;
|
|
30
|
-
|
|
32
|
+
set?(options: {
|
|
33
|
+
name: string;
|
|
34
|
+
value: string;
|
|
35
|
+
} & CookieOptions): unknown;
|
|
36
|
+
delete?(name: string): unknown;
|
|
37
|
+
delete?(options: {
|
|
38
|
+
name: string;
|
|
39
|
+
} & CookieOptions): unknown;
|
|
40
|
+
}
|
|
41
|
+
interface CookieStore extends CookieReader, CookieWriter {
|
|
31
42
|
}
|
|
32
43
|
interface AuthCookieSettings {
|
|
33
44
|
names?: AuthCookieNames;
|
|
@@ -37,11 +48,11 @@ declare function getAccessTokenCookieName(names?: AuthCookieNames): string;
|
|
|
37
48
|
declare function getRefreshTokenCookieName(names?: AuthCookieNames): string;
|
|
38
49
|
declare function accessTokenCookieOptions(token: string, overrides?: CookieOptions): CookieOptions;
|
|
39
50
|
declare function refreshTokenCookieOptions(token: string, overrides?: CookieOptions): CookieOptions;
|
|
40
|
-
declare function setAuthCookies(
|
|
51
|
+
declare function setAuthCookies(cookies: CookieWriter | undefined, tokens: {
|
|
41
52
|
accessToken: string;
|
|
42
53
|
refreshToken?: string | null;
|
|
43
54
|
}, settings?: AuthCookieSettings): void;
|
|
44
|
-
declare function clearAuthCookies(
|
|
55
|
+
declare function clearAuthCookies(cookies: CookieWriter | undefined, settings?: AuthCookieSettings): void;
|
|
45
56
|
|
|
46
57
|
interface CreateBrowserClientOptions extends Omit<InsForgeConfig, 'edgeFunctionToken' | 'isServerMode' | 'auth'>, AuthCookieSettings {
|
|
47
58
|
refreshUrl?: string;
|
|
@@ -85,4 +96,4 @@ interface UpdateSessionResult {
|
|
|
85
96
|
}
|
|
86
97
|
declare function updateSession(options: UpdateSessionOptions): Promise<UpdateSessionResult>;
|
|
87
98
|
|
|
88
|
-
export { type AuthCookieNames, type AuthCookieOptions, type AuthCookieSettings, type CookieOptions, type CookieStore, type CreateBrowserClientOptions, type CreateServerClientOptions, DEFAULT_ACCESS_TOKEN_COOKIE, DEFAULT_REFRESH_TOKEN_COOKIE, type RefreshAuthOptions, type RefreshAuthResult, type RefreshAuthRouteHandler, type UpdateSessionOptions, type UpdateSessionResult, accessTokenCookieOptions, clearAuthCookies, createBrowserClient, createRefreshAuthRouter, createServerClient, getAccessTokenCookieName, getRefreshTokenCookieName, refreshAuth, refreshTokenCookieOptions, setAuthCookies, updateSession };
|
|
99
|
+
export { type AuthCookieNames, type AuthCookieOptions, type AuthCookieSettings, type CookieOptions, type CookieReader, type CookieStore, type CookieWriter, type CreateBrowserClientOptions, type CreateServerClientOptions, DEFAULT_ACCESS_TOKEN_COOKIE, DEFAULT_REFRESH_TOKEN_COOKIE, type RefreshAuthOptions, type RefreshAuthResult, type RefreshAuthRouteHandler, type UpdateSessionOptions, type UpdateSessionResult, accessTokenCookieOptions, clearAuthCookies, createBrowserClient, createRefreshAuthRouter, createServerClient, getAccessTokenCookieName, getRefreshTokenCookieName, refreshAuth, refreshTokenCookieOptions, setAuthCookies, updateSession };
|
package/dist/ssr.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
2
3
|
var __defProp = Object.defineProperty;
|
|
3
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
5
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
8
|
var __export = (target, all) => {
|
|
7
9
|
for (var name in all)
|
|
@@ -15,6 +17,14 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
15
17
|
}
|
|
16
18
|
return to;
|
|
17
19
|
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
18
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
29
|
|
|
20
30
|
// src/ssr.ts
|
|
@@ -2215,7 +2225,6 @@ var Functions = class _Functions {
|
|
|
2215
2225
|
};
|
|
2216
2226
|
|
|
2217
2227
|
// src/modules/realtime.ts
|
|
2218
|
-
var import_socket = require("socket.io-client");
|
|
2219
2228
|
var CONNECT_TIMEOUT = 1e4;
|
|
2220
2229
|
var Realtime = class {
|
|
2221
2230
|
constructor(baseUrl, tokenManager, anonKey) {
|
|
@@ -2250,61 +2259,69 @@ var Realtime = class {
|
|
|
2250
2259
|
if (this.connectPromise) {
|
|
2251
2260
|
return this.connectPromise;
|
|
2252
2261
|
}
|
|
2253
|
-
this.connectPromise =
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
this.socket.
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
|
|
2297
|
-
|
|
2298
|
-
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
|
|
2262
|
+
this.connectPromise = (async () => {
|
|
2263
|
+
try {
|
|
2264
|
+
const { io } = await import("socket.io-client");
|
|
2265
|
+
await new Promise((resolve, reject) => {
|
|
2266
|
+
const token = this.tokenManager.getAccessToken() ?? this.anonKey;
|
|
2267
|
+
this.socket = io(this.baseUrl, {
|
|
2268
|
+
transports: ["websocket"],
|
|
2269
|
+
auth: token ? { token } : void 0
|
|
2270
|
+
});
|
|
2271
|
+
let initialConnection = true;
|
|
2272
|
+
let timeoutId = null;
|
|
2273
|
+
const cleanup = () => {
|
|
2274
|
+
if (timeoutId) {
|
|
2275
|
+
clearTimeout(timeoutId);
|
|
2276
|
+
timeoutId = null;
|
|
2277
|
+
}
|
|
2278
|
+
};
|
|
2279
|
+
timeoutId = setTimeout(() => {
|
|
2280
|
+
if (initialConnection) {
|
|
2281
|
+
initialConnection = false;
|
|
2282
|
+
this.connectPromise = null;
|
|
2283
|
+
this.socket?.disconnect();
|
|
2284
|
+
this.socket = null;
|
|
2285
|
+
reject(new Error(`Connection timeout after ${CONNECT_TIMEOUT}ms`));
|
|
2286
|
+
}
|
|
2287
|
+
}, CONNECT_TIMEOUT);
|
|
2288
|
+
this.socket.on("connect", () => {
|
|
2289
|
+
cleanup();
|
|
2290
|
+
for (const channel of this.subscribedChannels) {
|
|
2291
|
+
this.socket.emit("realtime:subscribe", { channel });
|
|
2292
|
+
}
|
|
2293
|
+
this.notifyListeners("connect");
|
|
2294
|
+
if (initialConnection) {
|
|
2295
|
+
initialConnection = false;
|
|
2296
|
+
this.connectPromise = null;
|
|
2297
|
+
resolve();
|
|
2298
|
+
}
|
|
2299
|
+
});
|
|
2300
|
+
this.socket.on("connect_error", (error) => {
|
|
2301
|
+
cleanup();
|
|
2302
|
+
this.notifyListeners("connect_error", error);
|
|
2303
|
+
if (initialConnection) {
|
|
2304
|
+
initialConnection = false;
|
|
2305
|
+
this.connectPromise = null;
|
|
2306
|
+
reject(error);
|
|
2307
|
+
}
|
|
2308
|
+
});
|
|
2309
|
+
this.socket.on("disconnect", (reason) => {
|
|
2310
|
+
this.notifyListeners("disconnect", reason);
|
|
2311
|
+
});
|
|
2312
|
+
this.socket.on("realtime:error", (error) => {
|
|
2313
|
+
this.notifyListeners("error", error);
|
|
2314
|
+
});
|
|
2315
|
+
this.socket.onAny((event, message) => {
|
|
2316
|
+
if (event === "realtime:error") return;
|
|
2317
|
+
this.notifyListeners(event, message);
|
|
2318
|
+
});
|
|
2319
|
+
});
|
|
2320
|
+
} catch (error) {
|
|
2321
|
+
this.connectPromise = null;
|
|
2322
|
+
throw error;
|
|
2323
|
+
}
|
|
2324
|
+
})();
|
|
2308
2325
|
return this.connectPromise;
|
|
2309
2326
|
}
|
|
2310
2327
|
/**
|
|
@@ -2634,10 +2651,9 @@ function decodeBase64Url(input) {
|
|
|
2634
2651
|
normalized.length + (4 - normalized.length % 4) % 4,
|
|
2635
2652
|
"="
|
|
2636
2653
|
);
|
|
2637
|
-
|
|
2638
|
-
|
|
2639
|
-
|
|
2640
|
-
return Buffer.from(padded, "base64").toString("utf8");
|
|
2654
|
+
const binary = atob(padded);
|
|
2655
|
+
const bytes = Uint8Array.from(binary, (char) => char.charCodeAt(0));
|
|
2656
|
+
return new TextDecoder().decode(bytes);
|
|
2641
2657
|
}
|
|
2642
2658
|
function getJwtExpiration(token) {
|
|
2643
2659
|
if (!token) return null;
|
|
@@ -2735,11 +2751,11 @@ function setCookie(cookies, name, value, options) {
|
|
|
2735
2751
|
}
|
|
2736
2752
|
function deleteCookie(cookies, name, options) {
|
|
2737
2753
|
if (!cookies) return;
|
|
2738
|
-
if (cookies.
|
|
2739
|
-
cookies.
|
|
2754
|
+
if (cookies.set) {
|
|
2755
|
+
cookies.set(name, "", expiredCookieOptions(options));
|
|
2740
2756
|
return;
|
|
2741
2757
|
}
|
|
2742
|
-
cookies.
|
|
2758
|
+
cookies.delete?.(name);
|
|
2743
2759
|
}
|
|
2744
2760
|
function serializeCookie(name, value, options = {}) {
|
|
2745
2761
|
const parts = [`${encodeURIComponent(name)}=${encodeURIComponent(value)}`];
|
|
@@ -2758,32 +2774,17 @@ function serializeCookie(name, value, options = {}) {
|
|
|
2758
2774
|
function appendSetCookie(headers, name, value, options) {
|
|
2759
2775
|
headers.append("Set-Cookie", serializeCookie(name, value, options));
|
|
2760
2776
|
}
|
|
2761
|
-
function setAuthCookies(
|
|
2777
|
+
function setAuthCookies(cookies, tokens, settings = {}) {
|
|
2762
2778
|
const accessName = getAccessTokenCookieName(settings.names);
|
|
2763
2779
|
const refreshName = getRefreshTokenCookieName(settings.names);
|
|
2764
2780
|
const accessOptions = accessTokenCookieOptions(
|
|
2765
2781
|
tokens.accessToken,
|
|
2766
2782
|
settings.options?.accessToken
|
|
2767
2783
|
);
|
|
2768
|
-
|
|
2769
|
-
appendSetCookie(target, accessName, tokens.accessToken, accessOptions);
|
|
2770
|
-
if (tokens.refreshToken) {
|
|
2771
|
-
appendSetCookie(
|
|
2772
|
-
target,
|
|
2773
|
-
refreshName,
|
|
2774
|
-
tokens.refreshToken,
|
|
2775
|
-
refreshTokenCookieOptions(
|
|
2776
|
-
tokens.refreshToken,
|
|
2777
|
-
settings.options?.refreshToken
|
|
2778
|
-
)
|
|
2779
|
-
);
|
|
2780
|
-
}
|
|
2781
|
-
return;
|
|
2782
|
-
}
|
|
2783
|
-
setCookie(target, accessName, tokens.accessToken, accessOptions);
|
|
2784
|
+
setCookie(cookies, accessName, tokens.accessToken, accessOptions);
|
|
2784
2785
|
if (tokens.refreshToken) {
|
|
2785
2786
|
setCookie(
|
|
2786
|
-
|
|
2787
|
+
cookies,
|
|
2787
2788
|
refreshName,
|
|
2788
2789
|
tokens.refreshToken,
|
|
2789
2790
|
refreshTokenCookieOptions(
|
|
@@ -2793,18 +2794,48 @@ function setAuthCookies(target, tokens, settings = {}) {
|
|
|
2793
2794
|
);
|
|
2794
2795
|
}
|
|
2795
2796
|
}
|
|
2796
|
-
function clearAuthCookies(
|
|
2797
|
+
function clearAuthCookies(cookies, settings = {}) {
|
|
2797
2798
|
const accessName = getAccessTokenCookieName(settings.names);
|
|
2798
2799
|
const refreshName = getRefreshTokenCookieName(settings.names);
|
|
2799
2800
|
const accessOptions = expiredCookieOptions(settings.options?.accessToken);
|
|
2800
2801
|
const refreshOptions = expiredCookieOptions(settings.options?.refreshToken);
|
|
2801
|
-
|
|
2802
|
-
|
|
2803
|
-
|
|
2804
|
-
|
|
2802
|
+
deleteCookie(cookies, accessName, accessOptions);
|
|
2803
|
+
deleteCookie(cookies, refreshName, refreshOptions);
|
|
2804
|
+
}
|
|
2805
|
+
function setAuthCookieHeaders(headers, tokens, settings = {}) {
|
|
2806
|
+
const accessName = getAccessTokenCookieName(settings.names);
|
|
2807
|
+
const refreshName = getRefreshTokenCookieName(settings.names);
|
|
2808
|
+
appendSetCookie(
|
|
2809
|
+
headers,
|
|
2810
|
+
accessName,
|
|
2811
|
+
tokens.accessToken,
|
|
2812
|
+
accessTokenCookieOptions(tokens.accessToken, settings.options?.accessToken)
|
|
2813
|
+
);
|
|
2814
|
+
if (tokens.refreshToken) {
|
|
2815
|
+
appendSetCookie(
|
|
2816
|
+
headers,
|
|
2817
|
+
refreshName,
|
|
2818
|
+
tokens.refreshToken,
|
|
2819
|
+
refreshTokenCookieOptions(
|
|
2820
|
+
tokens.refreshToken,
|
|
2821
|
+
settings.options?.refreshToken
|
|
2822
|
+
)
|
|
2823
|
+
);
|
|
2805
2824
|
}
|
|
2806
|
-
|
|
2807
|
-
|
|
2825
|
+
}
|
|
2826
|
+
function clearAuthCookieHeaders(headers, settings = {}) {
|
|
2827
|
+
appendSetCookie(
|
|
2828
|
+
headers,
|
|
2829
|
+
getAccessTokenCookieName(settings.names),
|
|
2830
|
+
"",
|
|
2831
|
+
expiredCookieOptions(settings.options?.accessToken)
|
|
2832
|
+
);
|
|
2833
|
+
appendSetCookie(
|
|
2834
|
+
headers,
|
|
2835
|
+
getRefreshTokenCookieName(settings.names),
|
|
2836
|
+
"",
|
|
2837
|
+
expiredCookieOptions(settings.options?.refreshToken)
|
|
2838
|
+
);
|
|
2808
2839
|
}
|
|
2809
2840
|
|
|
2810
2841
|
// src/ssr/browser-client.ts
|
|
@@ -3029,7 +3060,7 @@ async function refreshAuth(options = {}) {
|
|
|
3029
3060
|
const headers = new Headers();
|
|
3030
3061
|
const refreshToken = readRefreshToken(options);
|
|
3031
3062
|
if (!refreshToken) {
|
|
3032
|
-
|
|
3063
|
+
clearAuthCookieHeaders(headers, options);
|
|
3033
3064
|
const error2 = new InsForgeError(
|
|
3034
3065
|
"Refresh token cookie is missing",
|
|
3035
3066
|
401,
|
|
@@ -3099,7 +3130,7 @@ async function refreshAuth(options = {}) {
|
|
|
3099
3130
|
error = normalizeError(caught);
|
|
3100
3131
|
}
|
|
3101
3132
|
if (error || !data?.accessToken) {
|
|
3102
|
-
|
|
3133
|
+
clearAuthCookieHeaders(headers, options);
|
|
3103
3134
|
const normalized = normalizeError(error);
|
|
3104
3135
|
return {
|
|
3105
3136
|
response: jsonResponse(
|
|
@@ -3118,7 +3149,7 @@ async function refreshAuth(options = {}) {
|
|
|
3118
3149
|
};
|
|
3119
3150
|
}
|
|
3120
3151
|
const nextRefreshToken = data.refreshToken ?? refreshToken;
|
|
3121
|
-
|
|
3152
|
+
setAuthCookieHeaders(
|
|
3122
3153
|
headers,
|
|
3123
3154
|
{
|
|
3124
3155
|
accessToken: data.accessToken,
|