@azure/msal-node 1.13.0 → 1.14.1
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/client/ClientApplication.d.ts +10 -0
- package/dist/client/ClientApplication.d.ts.map +1 -1
- package/dist/client/ConfidentialClientApplication.d.ts.map +1 -1
- package/dist/error/NodeAuthError.d.ts +8 -0
- package/dist/error/NodeAuthError.d.ts.map +1 -1
- package/dist/msal-node.cjs.development.js +141 -97
- package/dist/msal-node.cjs.development.js.map +1 -1
- package/dist/msal-node.cjs.production.min.js +1 -1
- package/dist/msal-node.cjs.production.min.js.map +1 -1
- package/dist/msal-node.esm.js +142 -98
- package/dist/msal-node.esm.js.map +1 -1
- package/dist/packageMetadata.d.ts +1 -1
- package/dist/request/AuthorizationCodeRequest.d.ts +2 -0
- package/dist/request/AuthorizationCodeRequest.d.ts.map +1 -1
- package/package.json +2 -2
|
@@ -91,6 +91,16 @@ export declare abstract class ClientApplication {
|
|
|
91
91
|
* Gets the token cache for the application.
|
|
92
92
|
*/
|
|
93
93
|
getTokenCache(): TokenCache;
|
|
94
|
+
/**
|
|
95
|
+
* Validates OIDC state by comparing the user cached state with the state received from the server.
|
|
96
|
+
*
|
|
97
|
+
* This API is provided for scenarios where you would use OAuth2.0 state parameter to mitigate against
|
|
98
|
+
* CSRF attacks.
|
|
99
|
+
* For more information about state, visit https://datatracker.ietf.org/doc/html/rfc6819#section-3.6.
|
|
100
|
+
* @param state
|
|
101
|
+
* @param cachedState
|
|
102
|
+
*/
|
|
103
|
+
protected validateState(state: string, cachedState: string): void;
|
|
94
104
|
/**
|
|
95
105
|
* Returns the logger instance
|
|
96
106
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ClientApplication.d.ts","sourceRoot":"","sources":["../src/client/ClientApplication.ts"],"names":[],"mappings":"AAKA,OAAO,EAEH,mBAAmB,EAEnB,oBAAoB,EAGpB,eAAe,EAEf,MAAM,EACN,sBA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AK,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,OAAO,GAAG,sBAAsB;IAWhI;;;;OAIG;YACW,eAAe;IAkB7B;;OAEG;IACH,UAAU,IAAI,IAAI;CAGrB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConfidentialClientApplication.d.ts","sourceRoot":"","sources":["../src/client/ConfidentialClientApplication.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAGxD,OAAO,EAKH,oBAAoB,EAMpB,iBAAiB,
|
|
1
|
+
{"version":3,"file":"ConfidentialClientApplication.d.ts","sourceRoot":"","sources":["../src/client/ConfidentialClientApplication.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAGxD,OAAO,EAKH,oBAAoB,EAMpB,iBAAiB,EAEpB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,8BAA8B,EAAE,MAAM,kCAAkC,CAAC;AAClF,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AAE7E;;;;GAIG;AACH,qBAAa,6BAA8B,SAAQ,iBAAkB,YAAW,8BAA8B;IAC1G,OAAO,CAAC,gBAAgB,CAAC,CAAoB;IAE7C;;;;;;;;;;;;;;;;;;OAkBG;gBACS,aAAa,EAAE,aAAa;IAMxC;;;;;OAKG;IACH,mBAAmB,CAAC,QAAQ,EAAE,iBAAiB,GAAG,IAAI;IAItD;;OAEG;IACU,8BAA8B,CAAC,OAAO,EAAE,uBAAuB,GAAG,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC;IAoDnH;;;;;;;;;;OAUG;IACU,sBAAsB,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC;IAyBrG,OAAO,CAAC,mBAAmB;CAyC9B"}
|
|
@@ -27,6 +27,10 @@ export declare const NodeAuthErrorMessage: {
|
|
|
27
27
|
code: string;
|
|
28
28
|
desc: string;
|
|
29
29
|
};
|
|
30
|
+
stateNotFoundError: {
|
|
31
|
+
code: string;
|
|
32
|
+
desc: string;
|
|
33
|
+
};
|
|
30
34
|
};
|
|
31
35
|
export declare class NodeAuthError extends AuthError {
|
|
32
36
|
constructor(errorCode: string, errorMessage?: string);
|
|
@@ -54,5 +58,9 @@ export declare class NodeAuthError extends AuthError {
|
|
|
54
58
|
* Creates an error thrown if the loopback server times out registering the auth code listener.
|
|
55
59
|
*/
|
|
56
60
|
static createLoopbackServerTimeoutError(): NodeAuthError;
|
|
61
|
+
/**
|
|
62
|
+
* Creates an error thrown when the state is not present.
|
|
63
|
+
*/
|
|
64
|
+
static createStateNotFoundError(): NodeAuthError;
|
|
57
65
|
}
|
|
58
66
|
//# sourceMappingURL=NodeAuthError.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NodeAuthError.d.ts","sourceRoot":"","sources":["../src/error/NodeAuthError.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE/C;;GAEG;AACH,eAAO,MAAM,oBAAoB
|
|
1
|
+
{"version":3,"file":"NodeAuthError.d.ts","sourceRoot":"","sources":["../src/error/NodeAuthError.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE/C;;GAEG;AACH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6BhC,CAAC;AAEF,qBAAa,aAAc,SAAQ,SAAS;gBAC5B,SAAS,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,MAAM;IAKpD;;OAEG;IACH,MAAM,CAAC,qCAAqC,IAAI,aAAa;IAK7D;;OAEG;IACH,MAAM,CAAC,kCAAkC,IAAI,aAAa;IAK1D;;OAEG;IACH,MAAM,CAAC,+BAA+B,IAAI,aAAa;IAKvD;;OAEG;IACH,MAAM,CAAC,iCAAiC,IAAI,aAAa;IAKzD;;OAEG;IACH,MAAM,CAAC,sCAAsC,IAAI,aAAa;IAK9D;;OAEG;IACH,MAAM,CAAC,gCAAgC,IAAI,aAAa;IAKxD;;OAEG;IACH,MAAM,CAAC,wBAAwB,IAAI,aAAa;CAGnD"}
|
|
@@ -191,7 +191,7 @@ const networkRequestViaProxy = (url, httpMethod, options, timeout) => {
|
|
|
191
191
|
if (statusCode < 200 || statusCode > 299) {
|
|
192
192
|
request.destroy();
|
|
193
193
|
socket.destroy();
|
|
194
|
-
reject(new Error(`
|
|
194
|
+
reject(new Error(` Error connecting to proxy: ${response.statusCode}, ${response == null ? void 0 : response.statusMessage}`));
|
|
195
195
|
}
|
|
196
196
|
|
|
197
197
|
if (tunnelRequestOptions.timeout) {
|
|
@@ -254,8 +254,6 @@ const networkRequestViaProxy = (url, httpMethod, options, timeout) => {
|
|
|
254
254
|
if ((statusCode < 200 || statusCode > 299) && // do not destroy the request for the device code flow
|
|
255
255
|
networkResponse.body["error"] !== Constants.AUTHORIZATION_PENDING) {
|
|
256
256
|
request.destroy();
|
|
257
|
-
socket.destroy();
|
|
258
|
-
reject(new Error(`HTTP status code ${statusCode}`));
|
|
259
257
|
}
|
|
260
258
|
|
|
261
259
|
resolve(networkResponse);
|
|
@@ -327,7 +325,6 @@ const networkRequestViaHttps = (url, httpMethod, options, timeout) => {
|
|
|
327
325
|
if ((statusCode < 200 || statusCode > 299) && // do not destroy the request for the device code flow
|
|
328
326
|
networkResponse.body["error"] !== Constants.AUTHORIZATION_PENDING) {
|
|
329
327
|
request.destroy();
|
|
330
|
-
reject(new Error(`HTTP status code ${statusCode}`));
|
|
331
328
|
}
|
|
332
329
|
|
|
333
330
|
resolve(networkResponse);
|
|
@@ -1772,7 +1769,109 @@ class TokenCache {
|
|
|
1772
1769
|
|
|
1773
1770
|
/* eslint-disable header/header */
|
|
1774
1771
|
const name = "@azure/msal-node";
|
|
1775
|
-
const version = "1.
|
|
1772
|
+
const version = "1.14.1";
|
|
1773
|
+
|
|
1774
|
+
/*
|
|
1775
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
1776
|
+
* Licensed under the MIT License.
|
|
1777
|
+
*/
|
|
1778
|
+
/**
|
|
1779
|
+
* NodeAuthErrorMessage class containing string constants used by error codes and messages.
|
|
1780
|
+
*/
|
|
1781
|
+
|
|
1782
|
+
const NodeAuthErrorMessage = {
|
|
1783
|
+
invalidLoopbackAddressType: {
|
|
1784
|
+
code: "invalid_loopback_server_address_type",
|
|
1785
|
+
desc: "Loopback server address is not type string. This is unexpected."
|
|
1786
|
+
},
|
|
1787
|
+
unableToLoadRedirectUri: {
|
|
1788
|
+
code: "unable_to_load_redirectUrl",
|
|
1789
|
+
desc: "Loopback server callback was invoked without a url. This is unexpected."
|
|
1790
|
+
},
|
|
1791
|
+
noAuthCodeInResponse: {
|
|
1792
|
+
code: "no_auth_code_in_response",
|
|
1793
|
+
desc: "No auth code found in the server response. Please check your network trace to determine what happened."
|
|
1794
|
+
},
|
|
1795
|
+
noLoopbackServerExists: {
|
|
1796
|
+
code: "no_loopback_server_exists",
|
|
1797
|
+
desc: "No loopback server exists yet."
|
|
1798
|
+
},
|
|
1799
|
+
loopbackServerAlreadyExists: {
|
|
1800
|
+
code: "loopback_server_already_exists",
|
|
1801
|
+
desc: "Loopback server already exists. Cannot create another."
|
|
1802
|
+
},
|
|
1803
|
+
loopbackServerTimeout: {
|
|
1804
|
+
code: "loopback_server_timeout",
|
|
1805
|
+
desc: "Timed out waiting for auth code listener to be registered."
|
|
1806
|
+
},
|
|
1807
|
+
stateNotFoundError: {
|
|
1808
|
+
code: "state_not_found",
|
|
1809
|
+
desc: "State not found. Please verify that the request originated from msal."
|
|
1810
|
+
}
|
|
1811
|
+
};
|
|
1812
|
+
class NodeAuthError extends msalCommon.AuthError {
|
|
1813
|
+
constructor(errorCode, errorMessage) {
|
|
1814
|
+
super(errorCode, errorMessage);
|
|
1815
|
+
this.name = "NodeAuthError";
|
|
1816
|
+
}
|
|
1817
|
+
/**
|
|
1818
|
+
* Creates an error thrown if loopback server address is of type string.
|
|
1819
|
+
*/
|
|
1820
|
+
|
|
1821
|
+
|
|
1822
|
+
static createInvalidLoopbackAddressTypeError() {
|
|
1823
|
+
return new NodeAuthError(NodeAuthErrorMessage.invalidLoopbackAddressType.code, `${NodeAuthErrorMessage.invalidLoopbackAddressType.desc}`);
|
|
1824
|
+
}
|
|
1825
|
+
/**
|
|
1826
|
+
* Creates an error thrown if the loopback server is unable to get a url.
|
|
1827
|
+
*/
|
|
1828
|
+
|
|
1829
|
+
|
|
1830
|
+
static createUnableToLoadRedirectUrlError() {
|
|
1831
|
+
return new NodeAuthError(NodeAuthErrorMessage.unableToLoadRedirectUri.code, `${NodeAuthErrorMessage.unableToLoadRedirectUri.desc}`);
|
|
1832
|
+
}
|
|
1833
|
+
/**
|
|
1834
|
+
* Creates an error thrown if the server response does not contain an auth code.
|
|
1835
|
+
*/
|
|
1836
|
+
|
|
1837
|
+
|
|
1838
|
+
static createNoAuthCodeInResponseError() {
|
|
1839
|
+
return new NodeAuthError(NodeAuthErrorMessage.noAuthCodeInResponse.code, `${NodeAuthErrorMessage.noAuthCodeInResponse.desc}`);
|
|
1840
|
+
}
|
|
1841
|
+
/**
|
|
1842
|
+
* Creates an error thrown if the loopback server has not been spun up yet.
|
|
1843
|
+
*/
|
|
1844
|
+
|
|
1845
|
+
|
|
1846
|
+
static createNoLoopbackServerExistsError() {
|
|
1847
|
+
return new NodeAuthError(NodeAuthErrorMessage.noLoopbackServerExists.code, `${NodeAuthErrorMessage.noLoopbackServerExists.desc}`);
|
|
1848
|
+
}
|
|
1849
|
+
/**
|
|
1850
|
+
* Creates an error thrown if a loopback server already exists when attempting to create another one.
|
|
1851
|
+
*/
|
|
1852
|
+
|
|
1853
|
+
|
|
1854
|
+
static createLoopbackServerAlreadyExistsError() {
|
|
1855
|
+
return new NodeAuthError(NodeAuthErrorMessage.loopbackServerAlreadyExists.code, `${NodeAuthErrorMessage.loopbackServerAlreadyExists.desc}`);
|
|
1856
|
+
}
|
|
1857
|
+
/**
|
|
1858
|
+
* Creates an error thrown if the loopback server times out registering the auth code listener.
|
|
1859
|
+
*/
|
|
1860
|
+
|
|
1861
|
+
|
|
1862
|
+
static createLoopbackServerTimeoutError() {
|
|
1863
|
+
return new NodeAuthError(NodeAuthErrorMessage.loopbackServerTimeout.code, `${NodeAuthErrorMessage.loopbackServerTimeout.desc}`);
|
|
1864
|
+
}
|
|
1865
|
+
/**
|
|
1866
|
+
* Creates an error thrown when the state is not present.
|
|
1867
|
+
*/
|
|
1868
|
+
|
|
1869
|
+
|
|
1870
|
+
static createStateNotFoundError() {
|
|
1871
|
+
return new NodeAuthError(NodeAuthErrorMessage.stateNotFoundError.code, NodeAuthErrorMessage.stateNotFoundError.desc);
|
|
1872
|
+
}
|
|
1873
|
+
|
|
1874
|
+
}
|
|
1776
1875
|
|
|
1777
1876
|
/*
|
|
1778
1877
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1828,7 +1927,17 @@ class ClientApplication {
|
|
|
1828
1927
|
|
|
1829
1928
|
|
|
1830
1929
|
async acquireTokenByCode(request, authCodePayLoad) {
|
|
1831
|
-
this.logger.info("acquireTokenByCode called"
|
|
1930
|
+
this.logger.info("acquireTokenByCode called");
|
|
1931
|
+
|
|
1932
|
+
if (request.state && authCodePayLoad) {
|
|
1933
|
+
this.logger.info("acquireTokenByCode - validating state");
|
|
1934
|
+
this.validateState(request.state, authCodePayLoad.state || ""); // eslint-disable-next-line no-param-reassign
|
|
1935
|
+
|
|
1936
|
+
authCodePayLoad = { ...authCodePayLoad,
|
|
1937
|
+
state: ""
|
|
1938
|
+
};
|
|
1939
|
+
}
|
|
1940
|
+
|
|
1832
1941
|
const validRequest = { ...request,
|
|
1833
1942
|
...(await this.initializeBaseRequest(request)),
|
|
1834
1943
|
authenticationScheme: msalCommon.AuthenticationScheme.BEARER
|
|
@@ -1953,6 +2062,26 @@ class ClientApplication {
|
|
|
1953
2062
|
this.logger.info("getTokenCache called");
|
|
1954
2063
|
return this.tokenCache;
|
|
1955
2064
|
}
|
|
2065
|
+
/**
|
|
2066
|
+
* Validates OIDC state by comparing the user cached state with the state received from the server.
|
|
2067
|
+
*
|
|
2068
|
+
* This API is provided for scenarios where you would use OAuth2.0 state parameter to mitigate against
|
|
2069
|
+
* CSRF attacks.
|
|
2070
|
+
* For more information about state, visit https://datatracker.ietf.org/doc/html/rfc6819#section-3.6.
|
|
2071
|
+
* @param state
|
|
2072
|
+
* @param cachedState
|
|
2073
|
+
*/
|
|
2074
|
+
|
|
2075
|
+
|
|
2076
|
+
validateState(state, cachedState) {
|
|
2077
|
+
if (!state) {
|
|
2078
|
+
throw NodeAuthError.createStateNotFoundError();
|
|
2079
|
+
}
|
|
2080
|
+
|
|
2081
|
+
if (state !== cachedState) {
|
|
2082
|
+
throw msalCommon.ClientAuthError.createStateMismatchError();
|
|
2083
|
+
}
|
|
2084
|
+
}
|
|
1956
2085
|
/**
|
|
1957
2086
|
* Returns the logger instance
|
|
1958
2087
|
*/
|
|
@@ -2101,96 +2230,6 @@ class ClientApplication {
|
|
|
2101
2230
|
|
|
2102
2231
|
}
|
|
2103
2232
|
|
|
2104
|
-
/*
|
|
2105
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2106
|
-
* Licensed under the MIT License.
|
|
2107
|
-
*/
|
|
2108
|
-
/**
|
|
2109
|
-
* NodeAuthErrorMessage class containing string constants used by error codes and messages.
|
|
2110
|
-
*/
|
|
2111
|
-
|
|
2112
|
-
const NodeAuthErrorMessage = {
|
|
2113
|
-
invalidLoopbackAddressType: {
|
|
2114
|
-
code: "invalid_loopback_server_address_type",
|
|
2115
|
-
desc: "Loopback server address is not type string. This is unexpected."
|
|
2116
|
-
},
|
|
2117
|
-
unableToLoadRedirectUri: {
|
|
2118
|
-
code: "unable_to_load_redirectUrl",
|
|
2119
|
-
desc: "Loopback server callback was invoked without a url. This is unexpected."
|
|
2120
|
-
},
|
|
2121
|
-
noAuthCodeInResponse: {
|
|
2122
|
-
code: "no_auth_code_in_response",
|
|
2123
|
-
desc: "No auth code found in the server response. Please check your network trace to determine what happened."
|
|
2124
|
-
},
|
|
2125
|
-
noLoopbackServerExists: {
|
|
2126
|
-
code: "no_loopback_server_exists",
|
|
2127
|
-
desc: "No loopback server exists yet."
|
|
2128
|
-
},
|
|
2129
|
-
loopbackServerAlreadyExists: {
|
|
2130
|
-
code: "loopback_server_already_exists",
|
|
2131
|
-
desc: "Loopback server already exists. Cannot create another."
|
|
2132
|
-
},
|
|
2133
|
-
loopbackServerTimeout: {
|
|
2134
|
-
code: "loopback_server_timeout",
|
|
2135
|
-
desc: "Timed out waiting for auth code listener to be registered."
|
|
2136
|
-
}
|
|
2137
|
-
};
|
|
2138
|
-
class NodeAuthError extends msalCommon.AuthError {
|
|
2139
|
-
constructor(errorCode, errorMessage) {
|
|
2140
|
-
super(errorCode, errorMessage);
|
|
2141
|
-
this.name = "NodeAuthError";
|
|
2142
|
-
}
|
|
2143
|
-
/**
|
|
2144
|
-
* Creates an error thrown if loopback server address is of type string.
|
|
2145
|
-
*/
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
static createInvalidLoopbackAddressTypeError() {
|
|
2149
|
-
return new NodeAuthError(NodeAuthErrorMessage.invalidLoopbackAddressType.code, `${NodeAuthErrorMessage.invalidLoopbackAddressType.desc}`);
|
|
2150
|
-
}
|
|
2151
|
-
/**
|
|
2152
|
-
* Creates an error thrown if the loopback server is unable to get a url.
|
|
2153
|
-
*/
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
static createUnableToLoadRedirectUrlError() {
|
|
2157
|
-
return new NodeAuthError(NodeAuthErrorMessage.unableToLoadRedirectUri.code, `${NodeAuthErrorMessage.unableToLoadRedirectUri.desc}`);
|
|
2158
|
-
}
|
|
2159
|
-
/**
|
|
2160
|
-
* Creates an error thrown if the server response does not contain an auth code.
|
|
2161
|
-
*/
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
static createNoAuthCodeInResponseError() {
|
|
2165
|
-
return new NodeAuthError(NodeAuthErrorMessage.noAuthCodeInResponse.code, `${NodeAuthErrorMessage.noAuthCodeInResponse.desc}`);
|
|
2166
|
-
}
|
|
2167
|
-
/**
|
|
2168
|
-
* Creates an error thrown if the loopback server has not been spun up yet.
|
|
2169
|
-
*/
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
static createNoLoopbackServerExistsError() {
|
|
2173
|
-
return new NodeAuthError(NodeAuthErrorMessage.noLoopbackServerExists.code, `${NodeAuthErrorMessage.noLoopbackServerExists.desc}`);
|
|
2174
|
-
}
|
|
2175
|
-
/**
|
|
2176
|
-
* Creates an error thrown if a loopback server already exists when attempting to create another one.
|
|
2177
|
-
*/
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
static createLoopbackServerAlreadyExistsError() {
|
|
2181
|
-
return new NodeAuthError(NodeAuthErrorMessage.loopbackServerAlreadyExists.code, `${NodeAuthErrorMessage.loopbackServerAlreadyExists.desc}`);
|
|
2182
|
-
}
|
|
2183
|
-
/**
|
|
2184
|
-
* Creates an error thrown if the loopback server times out registering the auth code listener.
|
|
2185
|
-
*/
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
static createLoopbackServerTimeoutError() {
|
|
2189
|
-
return new NodeAuthError(NodeAuthErrorMessage.loopbackServerTimeout.code, `${NodeAuthErrorMessage.loopbackServerTimeout.desc}`);
|
|
2190
|
-
}
|
|
2191
|
-
|
|
2192
|
-
}
|
|
2193
|
-
|
|
2194
2233
|
/*
|
|
2195
2234
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2196
2235
|
* Licensed under the MIT License.
|
|
@@ -2599,8 +2638,13 @@ class ConfidentialClientApplication extends ClientApplication {
|
|
|
2599
2638
|
};
|
|
2600
2639
|
}
|
|
2601
2640
|
|
|
2641
|
+
const baseRequest = await this.initializeBaseRequest(request); // valid base request should not contain oidc scopes in this grant type
|
|
2642
|
+
|
|
2643
|
+
const validBaseRequest = { ...baseRequest,
|
|
2644
|
+
scopes: baseRequest.scopes.filter(scope => !msalCommon.OIDC_DEFAULT_SCOPES.includes(scope))
|
|
2645
|
+
};
|
|
2602
2646
|
const validRequest = { ...request,
|
|
2603
|
-
...
|
|
2647
|
+
...validBaseRequest,
|
|
2604
2648
|
clientAssertion
|
|
2605
2649
|
};
|
|
2606
2650
|
const azureRegionConfiguration = {
|