@azure/msal-browser 3.26.1 → 3.28.0
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/app/IPublicClientApplication.mjs +1 -1
- package/dist/app/PublicClientApplication.mjs +1 -1
- package/dist/app/PublicClientNext.mjs +1 -1
- package/dist/broker/nativeBroker/NativeMessageHandler.mjs +1 -1
- package/dist/broker/nativeBroker/NativeRequest.d.ts +1 -0
- package/dist/broker/nativeBroker/NativeRequest.d.ts.map +1 -1
- package/dist/broker/nativeBroker/NativeStatusCodes.mjs +1 -1
- package/dist/cache/AccountManager.mjs +1 -1
- package/dist/cache/AsyncMemoryStorage.mjs +1 -1
- package/dist/cache/BrowserCacheManager.d.ts +2 -38
- package/dist/cache/BrowserCacheManager.d.ts.map +1 -1
- package/dist/cache/BrowserCacheManager.mjs +21 -115
- package/dist/cache/BrowserCacheManager.mjs.map +1 -1
- package/dist/cache/BrowserStorage.d.ts +3 -1
- package/dist/cache/BrowserStorage.d.ts.map +1 -1
- package/dist/cache/BrowserStorage.mjs +13 -8
- package/dist/cache/BrowserStorage.mjs.map +1 -1
- package/dist/cache/CookieStorage.d.ts +14 -0
- package/dist/cache/CookieStorage.d.ts.map +1 -0
- package/dist/cache/CookieStorage.mjs +62 -0
- package/dist/cache/CookieStorage.mjs.map +1 -0
- package/dist/cache/DatabaseStorage.mjs +1 -1
- package/dist/cache/LocalStorage.d.ts +10 -0
- package/dist/cache/LocalStorage.d.ts.map +1 -0
- package/dist/cache/LocalStorage.mjs +34 -0
- package/dist/cache/LocalStorage.mjs.map +1 -0
- package/dist/cache/MemoryStorage.mjs +1 -1
- package/dist/cache/SessionStorage.d.ts +10 -0
- package/dist/cache/SessionStorage.d.ts.map +1 -0
- package/dist/cache/SessionStorage.mjs +34 -0
- package/dist/cache/SessionStorage.mjs.map +1 -0
- package/dist/cache/TokenCache.mjs +1 -1
- package/dist/config/Configuration.d.ts.map +1 -1
- package/dist/config/Configuration.mjs +4 -3
- package/dist/config/Configuration.mjs.map +1 -1
- package/dist/controllers/ControllerFactory.mjs +1 -1
- package/dist/controllers/NestedAppAuthController.mjs +1 -1
- package/dist/controllers/StandardController.d.ts.map +1 -1
- package/dist/controllers/StandardController.mjs +1 -8
- package/dist/controllers/StandardController.mjs.map +1 -1
- package/dist/controllers/UnknownOperatingContextController.mjs +1 -1
- package/dist/crypto/BrowserCrypto.d.ts +2 -2
- package/dist/crypto/BrowserCrypto.d.ts.map +1 -1
- package/dist/crypto/BrowserCrypto.mjs +10 -7
- package/dist/crypto/BrowserCrypto.mjs.map +1 -1
- package/dist/crypto/CryptoOps.mjs +2 -2
- package/dist/crypto/CryptoOps.mjs.map +1 -1
- package/dist/crypto/PkceGenerator.mjs +1 -1
- package/dist/crypto/SignedHttpRequest.mjs +1 -1
- package/dist/encode/Base64Decode.mjs +1 -1
- package/dist/encode/Base64Encode.mjs +1 -1
- package/dist/error/BrowserAuthError.d.ts +4 -2
- package/dist/error/BrowserAuthError.d.ts.map +1 -1
- package/dist/error/BrowserAuthError.mjs +8 -6
- package/dist/error/BrowserAuthError.mjs.map +1 -1
- package/dist/error/BrowserAuthErrorCodes.d.ts +2 -0
- package/dist/error/BrowserAuthErrorCodes.d.ts.map +1 -1
- package/dist/error/BrowserAuthErrorCodes.mjs +5 -3
- package/dist/error/BrowserAuthErrorCodes.mjs.map +1 -1
- package/dist/error/BrowserConfigurationAuthError.mjs +1 -1
- package/dist/error/BrowserConfigurationAuthErrorCodes.mjs +1 -1
- package/dist/error/NativeAuthError.mjs +1 -1
- package/dist/error/NativeAuthErrorCodes.mjs +1 -1
- package/dist/error/NestedAppAuthError.mjs +1 -1
- package/dist/event/EventHandler.mjs +1 -1
- package/dist/event/EventMessage.mjs +1 -1
- package/dist/event/EventType.mjs +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +3 -1
- package/dist/index.mjs.map +1 -1
- package/dist/interaction_client/BaseInteractionClient.d.ts.map +1 -1
- package/dist/interaction_client/BaseInteractionClient.mjs +2 -4
- package/dist/interaction_client/BaseInteractionClient.mjs.map +1 -1
- package/dist/interaction_client/HybridSpaAuthorizationCodeClient.mjs +1 -1
- package/dist/interaction_client/NativeInteractionClient.d.ts.map +1 -1
- package/dist/interaction_client/NativeInteractionClient.mjs +25 -17
- package/dist/interaction_client/NativeInteractionClient.mjs.map +1 -1
- package/dist/interaction_client/PopupClient.mjs +1 -1
- package/dist/interaction_client/RedirectClient.mjs +1 -1
- package/dist/interaction_client/SilentAuthCodeClient.mjs +1 -1
- package/dist/interaction_client/SilentCacheClient.mjs +1 -1
- package/dist/interaction_client/SilentIframeClient.mjs +1 -1
- package/dist/interaction_client/SilentRefreshClient.mjs +1 -1
- package/dist/interaction_client/StandardInteractionClient.d.ts.map +1 -1
- package/dist/interaction_client/StandardInteractionClient.mjs +6 -1
- package/dist/interaction_client/StandardInteractionClient.mjs.map +1 -1
- package/dist/interaction_handler/InteractionHandler.mjs +1 -1
- package/dist/interaction_handler/RedirectHandler.mjs +1 -1
- package/dist/interaction_handler/SilentHandler.mjs +1 -1
- package/dist/naa/BridgeError.mjs +1 -1
- package/dist/naa/BridgeProxy.mjs +1 -1
- package/dist/naa/BridgeStatusCode.mjs +1 -1
- package/dist/naa/mapping/NestedAppAuthAdapter.d.ts.map +1 -1
- package/dist/naa/mapping/NestedAppAuthAdapter.mjs +4 -5
- package/dist/naa/mapping/NestedAppAuthAdapter.mjs.map +1 -1
- package/dist/navigation/NavigationClient.mjs +1 -1
- package/dist/network/FetchClient.d.ts +0 -6
- package/dist/network/FetchClient.d.ts.map +1 -1
- package/dist/network/FetchClient.mjs +51 -32
- package/dist/network/FetchClient.mjs.map +1 -1
- package/dist/operatingcontext/BaseOperatingContext.mjs +1 -1
- package/dist/operatingcontext/NestedAppOperatingContext.mjs +1 -1
- package/dist/operatingcontext/StandardOperatingContext.mjs +1 -1
- package/dist/operatingcontext/UnknownOperatingContext.mjs +1 -1
- package/dist/packageMetadata.d.ts +1 -1
- package/dist/packageMetadata.mjs +2 -2
- package/dist/request/RequestHelpers.mjs +1 -1
- package/dist/response/ResponseHandler.mjs +1 -1
- package/dist/telemetry/BrowserPerformanceClient.mjs +1 -1
- package/dist/telemetry/BrowserPerformanceMeasurement.mjs +1 -1
- package/dist/utils/BrowserConstants.mjs +1 -1
- package/dist/utils/BrowserProtocolUtils.mjs +1 -1
- package/dist/utils/BrowserUtils.mjs +1 -1
- package/lib/msal-browser.cjs +627 -472
- package/lib/msal-browser.cjs.map +1 -1
- package/lib/msal-browser.js +627 -472
- package/lib/msal-browser.js.map +1 -1
- package/lib/msal-browser.min.js +66 -66
- package/lib/types/broker/nativeBroker/NativeRequest.d.ts +1 -0
- package/lib/types/broker/nativeBroker/NativeRequest.d.ts.map +1 -1
- package/lib/types/cache/BrowserCacheManager.d.ts +2 -38
- package/lib/types/cache/BrowserCacheManager.d.ts.map +1 -1
- package/lib/types/cache/BrowserStorage.d.ts +3 -1
- package/lib/types/cache/BrowserStorage.d.ts.map +1 -1
- package/lib/types/cache/CookieStorage.d.ts +14 -0
- package/lib/types/cache/CookieStorage.d.ts.map +1 -0
- package/lib/types/cache/LocalStorage.d.ts +10 -0
- package/lib/types/cache/LocalStorage.d.ts.map +1 -0
- package/lib/types/cache/SessionStorage.d.ts +10 -0
- package/lib/types/cache/SessionStorage.d.ts.map +1 -0
- package/lib/types/config/Configuration.d.ts.map +1 -1
- package/lib/types/controllers/StandardController.d.ts.map +1 -1
- package/lib/types/crypto/BrowserCrypto.d.ts +2 -2
- package/lib/types/crypto/BrowserCrypto.d.ts.map +1 -1
- package/lib/types/error/BrowserAuthError.d.ts +4 -2
- package/lib/types/error/BrowserAuthError.d.ts.map +1 -1
- package/lib/types/error/BrowserAuthErrorCodes.d.ts +2 -0
- package/lib/types/error/BrowserAuthErrorCodes.d.ts.map +1 -1
- package/lib/types/index.d.ts +3 -0
- package/lib/types/index.d.ts.map +1 -1
- package/lib/types/interaction_client/BaseInteractionClient.d.ts.map +1 -1
- package/lib/types/interaction_client/NativeInteractionClient.d.ts.map +1 -1
- package/lib/types/interaction_client/StandardInteractionClient.d.ts.map +1 -1
- package/lib/types/naa/mapping/NestedAppAuthAdapter.d.ts.map +1 -1
- package/lib/types/network/FetchClient.d.ts +0 -6
- package/lib/types/network/FetchClient.d.ts.map +1 -1
- package/lib/types/packageMetadata.d.ts +1 -1
- package/package.json +3 -3
- package/src/broker/nativeBroker/NativeRequest.ts +1 -0
- package/src/cache/BrowserCacheManager.ts +27 -141
- package/src/cache/BrowserStorage.ts +11 -11
- package/src/cache/CookieStorage.ts +80 -0
- package/src/cache/LocalStorage.ts +40 -0
- package/src/cache/SessionStorage.ts +40 -0
- package/src/config/Configuration.ts +3 -1
- package/src/controllers/StandardController.ts +0 -7
- package/src/crypto/BrowserCrypto.ts +15 -6
- package/src/crypto/CryptoOps.ts +1 -1
- package/src/error/BrowserAuthError.ts +11 -4
- package/src/error/BrowserAuthErrorCodes.ts +2 -0
- package/src/index.ts +3 -0
- package/src/interaction_client/BaseInteractionClient.ts +1 -4
- package/src/interaction_client/NativeInteractionClient.ts +35 -25
- package/src/interaction_client/StandardInteractionClient.ts +6 -0
- package/src/naa/mapping/NestedAppAuthAdapter.ts +4 -5
- package/src/network/FetchClient.ts +67 -40
- package/src/packageMetadata.ts +1 -1
|
@@ -76,11 +76,6 @@ import { AuthenticationResult } from "../response/AuthenticationResult.js";
|
|
|
76
76
|
import { base64Decode } from "../encode/Base64Decode.js";
|
|
77
77
|
import { version } from "../packageMetadata.js";
|
|
78
78
|
|
|
79
|
-
const BrokerServerParamKeys = {
|
|
80
|
-
BROKER_CLIENT_ID: "brk_client_id",
|
|
81
|
-
BROKER_REDIRECT_URI: "brk_redirect_uri",
|
|
82
|
-
};
|
|
83
|
-
|
|
84
79
|
export class NativeInteractionClient extends BaseInteractionClient {
|
|
85
80
|
protected apiId: ApiId;
|
|
86
81
|
protected accountId: string;
|
|
@@ -1044,31 +1039,46 @@ export class NativeInteractionClient extends BaseInteractionClient {
|
|
|
1044
1039
|
* @private
|
|
1045
1040
|
*/
|
|
1046
1041
|
private handleExtraBrokerParams(request: NativeTokenRequest): void {
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
}
|
|
1050
|
-
|
|
1051
|
-
if (
|
|
1042
|
+
const hasExtraBrokerParams =
|
|
1043
|
+
request.extraParameters &&
|
|
1052
1044
|
request.extraParameters.hasOwnProperty(
|
|
1053
|
-
|
|
1045
|
+
AADServerParamKeys.BROKER_CLIENT_ID
|
|
1054
1046
|
) &&
|
|
1055
1047
|
request.extraParameters.hasOwnProperty(
|
|
1056
|
-
|
|
1048
|
+
AADServerParamKeys.BROKER_REDIRECT_URI
|
|
1057
1049
|
) &&
|
|
1058
|
-
request.extraParameters.hasOwnProperty(
|
|
1059
|
-
|
|
1060
|
-
|
|
1050
|
+
request.extraParameters.hasOwnProperty(
|
|
1051
|
+
AADServerParamKeys.CLIENT_ID
|
|
1052
|
+
);
|
|
1053
|
+
|
|
1054
|
+
if (!request.embeddedClientId && !hasExtraBrokerParams) {
|
|
1055
|
+
return;
|
|
1056
|
+
}
|
|
1057
|
+
|
|
1058
|
+
let child_client_id: string = "";
|
|
1059
|
+
const child_redirect_uri = request.redirectUri;
|
|
1060
|
+
|
|
1061
|
+
if (request.embeddedClientId) {
|
|
1062
|
+
request.redirectUri = this.config.auth.redirectUri;
|
|
1063
|
+
child_client_id = request.embeddedClientId;
|
|
1064
|
+
} else if (request.extraParameters) {
|
|
1065
|
+
request.redirectUri =
|
|
1066
|
+
request.extraParameters[AADServerParamKeys.BROKER_REDIRECT_URI];
|
|
1067
|
+
child_client_id =
|
|
1061
1068
|
request.extraParameters[AADServerParamKeys.CLIENT_ID];
|
|
1062
|
-
const child_redirect_uri = request.redirectUri;
|
|
1063
|
-
const brk_redirect_uri =
|
|
1064
|
-
request.extraParameters[
|
|
1065
|
-
BrokerServerParamKeys.BROKER_REDIRECT_URI
|
|
1066
|
-
];
|
|
1067
|
-
request.extraParameters = {
|
|
1068
|
-
child_client_id,
|
|
1069
|
-
child_redirect_uri,
|
|
1070
|
-
};
|
|
1071
|
-
request.redirectUri = brk_redirect_uri;
|
|
1072
1069
|
}
|
|
1070
|
+
|
|
1071
|
+
request.extraParameters = {
|
|
1072
|
+
child_client_id,
|
|
1073
|
+
child_redirect_uri,
|
|
1074
|
+
};
|
|
1075
|
+
|
|
1076
|
+
this.performanceClient?.addFields(
|
|
1077
|
+
{
|
|
1078
|
+
embeddedClientId: child_client_id,
|
|
1079
|
+
embeddedRedirectUri: child_redirect_uri,
|
|
1080
|
+
},
|
|
1081
|
+
request.correlationId
|
|
1082
|
+
);
|
|
1073
1083
|
}
|
|
1074
1084
|
}
|
|
@@ -285,6 +285,7 @@ export abstract class StandardInteractionClient extends BaseInteractionClient {
|
|
|
285
285
|
clientId: this.config.auth.clientId,
|
|
286
286
|
authority: discoveredAuthority,
|
|
287
287
|
clientCapabilities: this.config.auth.clientCapabilities,
|
|
288
|
+
redirectUri: this.config.auth.redirectUri,
|
|
288
289
|
},
|
|
289
290
|
systemOptions: {
|
|
290
291
|
tokenRenewalOffsetSeconds:
|
|
@@ -361,6 +362,11 @@ export abstract class StandardInteractionClient extends BaseInteractionClient {
|
|
|
361
362
|
.serverResponseType as ResponseMode,
|
|
362
363
|
};
|
|
363
364
|
|
|
365
|
+
// Skip active account lookup if either login hint or session id is set
|
|
366
|
+
if (request.loginHint || request.sid) {
|
|
367
|
+
return validatedRequest;
|
|
368
|
+
}
|
|
369
|
+
|
|
364
370
|
const account =
|
|
365
371
|
request.account || this.browserStorage.getActiveAccount();
|
|
366
372
|
if (account) {
|
|
@@ -72,7 +72,9 @@ export class NestedAppAuthAdapter {
|
|
|
72
72
|
);
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
-
const
|
|
75
|
+
const correlationId =
|
|
76
|
+
request.correlationId || this.crypto.createNewGuid();
|
|
77
|
+
const requestBuilder = new RequestParameterBuilder(correlationId);
|
|
76
78
|
const claims = requestBuilder.addClientCapabilitiesToClaims(
|
|
77
79
|
request.claims,
|
|
78
80
|
this.clientCapabilities
|
|
@@ -83,10 +85,7 @@ export class NestedAppAuthAdapter {
|
|
|
83
85
|
clientId: this.clientId,
|
|
84
86
|
authority: request.authority,
|
|
85
87
|
scope: scopes.join(" "),
|
|
86
|
-
correlationId
|
|
87
|
-
request.correlationId !== undefined
|
|
88
|
-
? request.correlationId
|
|
89
|
-
: this.crypto.createNewGuid(),
|
|
88
|
+
correlationId,
|
|
90
89
|
claims: !StringUtils.isEmptyObj(claims) ? claims : undefined,
|
|
91
90
|
state: request.state,
|
|
92
91
|
authenticationScheme:
|
|
@@ -4,10 +4,10 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import {
|
|
7
|
-
Constants,
|
|
8
7
|
INetworkModule,
|
|
9
8
|
NetworkRequestOptions,
|
|
10
9
|
NetworkResponse,
|
|
10
|
+
createNetworkError,
|
|
11
11
|
} from "@azure/msal-common/browser";
|
|
12
12
|
import {
|
|
13
13
|
createBrowserAuthError,
|
|
@@ -29,33 +29,38 @@ export class FetchClient implements INetworkModule {
|
|
|
29
29
|
url: string,
|
|
30
30
|
options?: NetworkRequestOptions
|
|
31
31
|
): Promise<NetworkResponse<T>> {
|
|
32
|
-
let response;
|
|
32
|
+
let response: Response;
|
|
33
|
+
let responseHeaders: Record<string, string> = {};
|
|
34
|
+
let responseStatus = 0;
|
|
35
|
+
const reqHeaders = getFetchHeaders(options);
|
|
33
36
|
try {
|
|
34
37
|
response = await fetch(url, {
|
|
35
38
|
method: HTTP_REQUEST_TYPE.GET,
|
|
36
|
-
headers:
|
|
39
|
+
headers: reqHeaders,
|
|
37
40
|
});
|
|
38
41
|
} catch (e) {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
BrowserAuthErrorCodes.getRequestFailed
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
throw createBrowserAuthError(
|
|
45
|
-
BrowserAuthErrorCodes.noNetworkConnectivity
|
|
46
|
-
);
|
|
47
|
-
}
|
|
42
|
+
throw createBrowserAuthError(
|
|
43
|
+
window.navigator.onLine
|
|
44
|
+
? BrowserAuthErrorCodes.getRequestFailed
|
|
45
|
+
: BrowserAuthErrorCodes.noNetworkConnectivity
|
|
46
|
+
);
|
|
48
47
|
}
|
|
49
48
|
|
|
49
|
+
responseHeaders = getHeaderDict(response.headers);
|
|
50
50
|
try {
|
|
51
|
+
responseStatus = response.status;
|
|
51
52
|
return {
|
|
52
|
-
headers:
|
|
53
|
+
headers: responseHeaders,
|
|
53
54
|
body: (await response.json()) as T,
|
|
54
|
-
status:
|
|
55
|
+
status: responseStatus,
|
|
55
56
|
};
|
|
56
57
|
} catch (e) {
|
|
57
|
-
throw
|
|
58
|
-
|
|
58
|
+
throw createNetworkError(
|
|
59
|
+
createBrowserAuthError(
|
|
60
|
+
BrowserAuthErrorCodes.failedToParseResponse
|
|
61
|
+
),
|
|
62
|
+
responseStatus,
|
|
63
|
+
responseHeaders
|
|
59
64
|
);
|
|
60
65
|
}
|
|
61
66
|
}
|
|
@@ -70,61 +75,83 @@ export class FetchClient implements INetworkModule {
|
|
|
70
75
|
url: string,
|
|
71
76
|
options?: NetworkRequestOptions
|
|
72
77
|
): Promise<NetworkResponse<T>> {
|
|
73
|
-
const reqBody = (options && options.body) ||
|
|
78
|
+
const reqBody = (options && options.body) || "";
|
|
79
|
+
const reqHeaders = getFetchHeaders(options);
|
|
74
80
|
|
|
75
|
-
let response;
|
|
81
|
+
let response: Response;
|
|
82
|
+
let responseStatus = 0;
|
|
83
|
+
let responseHeaders: Record<string, string> = {};
|
|
76
84
|
try {
|
|
77
85
|
response = await fetch(url, {
|
|
78
86
|
method: HTTP_REQUEST_TYPE.POST,
|
|
79
|
-
headers:
|
|
87
|
+
headers: reqHeaders,
|
|
80
88
|
body: reqBody,
|
|
81
89
|
});
|
|
82
90
|
} catch (e) {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
BrowserAuthErrorCodes.postRequestFailed
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
throw createBrowserAuthError(
|
|
89
|
-
BrowserAuthErrorCodes.noNetworkConnectivity
|
|
90
|
-
);
|
|
91
|
-
}
|
|
91
|
+
throw createBrowserAuthError(
|
|
92
|
+
window.navigator.onLine
|
|
93
|
+
? BrowserAuthErrorCodes.postRequestFailed
|
|
94
|
+
: BrowserAuthErrorCodes.noNetworkConnectivity
|
|
95
|
+
);
|
|
92
96
|
}
|
|
93
97
|
|
|
98
|
+
responseHeaders = getHeaderDict(response.headers);
|
|
94
99
|
try {
|
|
100
|
+
responseStatus = response.status;
|
|
95
101
|
return {
|
|
96
|
-
headers:
|
|
102
|
+
headers: responseHeaders,
|
|
97
103
|
body: (await response.json()) as T,
|
|
98
|
-
status:
|
|
104
|
+
status: responseStatus,
|
|
99
105
|
};
|
|
100
106
|
} catch (e) {
|
|
101
|
-
throw
|
|
102
|
-
|
|
107
|
+
throw createNetworkError(
|
|
108
|
+
createBrowserAuthError(
|
|
109
|
+
BrowserAuthErrorCodes.failedToParseResponse
|
|
110
|
+
),
|
|
111
|
+
responseStatus,
|
|
112
|
+
responseHeaders
|
|
103
113
|
);
|
|
104
114
|
}
|
|
105
115
|
}
|
|
116
|
+
}
|
|
106
117
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
118
|
+
/**
|
|
119
|
+
* Get Fetch API Headers object from string map
|
|
120
|
+
* @param inputHeaders
|
|
121
|
+
*/
|
|
122
|
+
function getFetchHeaders(options?: NetworkRequestOptions): Headers {
|
|
123
|
+
try {
|
|
112
124
|
const headers = new Headers();
|
|
113
125
|
if (!(options && options.headers)) {
|
|
114
126
|
return headers;
|
|
115
127
|
}
|
|
116
128
|
const optionsHeaders = options.headers;
|
|
117
|
-
Object.
|
|
118
|
-
headers.append(key,
|
|
129
|
+
Object.entries(optionsHeaders).forEach(([key, value]) => {
|
|
130
|
+
headers.append(key, value);
|
|
119
131
|
});
|
|
120
132
|
return headers;
|
|
133
|
+
} catch (e) {
|
|
134
|
+
throw createBrowserAuthError(
|
|
135
|
+
BrowserAuthErrorCodes.failedToBuildHeaders
|
|
136
|
+
);
|
|
121
137
|
}
|
|
138
|
+
}
|
|
122
139
|
|
|
123
|
-
|
|
140
|
+
/**
|
|
141
|
+
* Returns object representing response headers
|
|
142
|
+
* @param headers
|
|
143
|
+
* @returns
|
|
144
|
+
*/
|
|
145
|
+
function getHeaderDict(headers: Headers): Record<string, string> {
|
|
146
|
+
try {
|
|
124
147
|
const headerDict: Record<string, string> = {};
|
|
125
148
|
headers.forEach((value: string, key: string) => {
|
|
126
149
|
headerDict[key] = value;
|
|
127
150
|
});
|
|
128
151
|
return headerDict;
|
|
152
|
+
} catch (e) {
|
|
153
|
+
throw createBrowserAuthError(
|
|
154
|
+
BrowserAuthErrorCodes.failedToParseHeaders
|
|
155
|
+
);
|
|
129
156
|
}
|
|
130
157
|
}
|
package/src/packageMetadata.ts
CHANGED