microsoft-graph 3.7.0 → 3.7.2
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/cjs/services/azureApplicationCredentials.d.ts +2 -7
- package/dist/cjs/services/azureApplicationCredentials.d.ts.map +1 -1
- package/dist/cjs/services/azureApplicationCredentials.js +2 -7
- package/dist/cjs/services/context.d.ts +11 -8
- package/dist/cjs/services/context.d.ts.map +1 -1
- package/dist/cjs/services/context.js +19 -16
- package/dist/cjs/services/httpStatus.d.ts.map +1 -1
- package/dist/cjs/services/httpStatus.js +2 -1
- package/dist/cjs/services/operationInvoker.d.ts.map +1 -1
- package/dist/cjs/services/operationInvoker.js +18 -1
- package/dist/esm/services/azureApplicationCredentials.d.ts +2 -7
- package/dist/esm/services/azureApplicationCredentials.d.ts.map +1 -1
- package/dist/esm/services/azureApplicationCredentials.js +2 -7
- package/dist/esm/services/context.d.ts +11 -8
- package/dist/esm/services/context.d.ts.map +1 -1
- package/dist/esm/services/context.js +18 -15
- package/dist/esm/services/httpStatus.d.ts.map +1 -1
- package/dist/esm/services/httpStatus.js +2 -1
- package/dist/esm/services/operationInvoker.d.ts.map +1 -1
- package/dist/esm/services/operationInvoker.js +18 -1
- package/docs/api/README.md +1 -2
- package/docs/api/context.md +28 -26
- package/docs/api/drive.md +3 -3
- package/docs/api/operationInvoker.md +1 -1
- package/package.json +1 -1
- package/docs/api/azureApplicationCredentials.md +0 -31
- /package/docs/api/{AzureApplicationCredentials-1.md → AzureApplicationCredentials.md} +0 -0
|
@@ -2,17 +2,12 @@
|
|
|
2
2
|
* Azure application credential helpers for authentication and token management.
|
|
3
3
|
* @module azureApplicationCredentials
|
|
4
4
|
* @category Services
|
|
5
|
+
* @hidden
|
|
5
6
|
*/
|
|
6
7
|
import type { AccessToken } from "../models/AccessToken.ts";
|
|
7
8
|
import type { AzureClientId, AzureClientSecret, AzureTenantId, Scope } from "../models/AzureApplicationCredentials.ts";
|
|
8
9
|
/**
|
|
9
|
-
*
|
|
10
|
-
* If a valid token is cached, it will be returned; otherwise, a new token will be requested.
|
|
11
|
-
* @param tenantId - The tenant ID.
|
|
12
|
-
* @param clientId - The client ID.
|
|
13
|
-
* @param clientSecret - The client secret.
|
|
14
|
-
* @param scope - The scope for which the token is requested.
|
|
15
|
-
* @returns A promise that resolves to the access token.
|
|
10
|
+
* @deprecated
|
|
16
11
|
*/
|
|
17
12
|
export declare function getCurrentAccessToken(tenantId: AzureTenantId, clientId: AzureClientId, clientSecret: AzureClientSecret, scope: Scope): Promise<AccessToken>;
|
|
18
13
|
//# sourceMappingURL=azureApplicationCredentials.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"azureApplicationCredentials.d.ts","sourceRoot":"","sources":["../../../src/services/azureApplicationCredentials.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"azureApplicationCredentials.d.ts","sourceRoot":"","sources":["../../../src/services/azureApplicationCredentials.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,KAAK,EAAE,aAAa,EAAE,iBAAiB,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,0CAA0C,CAAC;AAIvH;;GAEG;AACH,wBAAsB,qBAAqB,CAAC,QAAQ,EAAE,aAAa,EAAE,QAAQ,EAAE,aAAa,EAAE,YAAY,EAAE,iBAAiB,EAAE,KAAK,EAAE,KAAK,GAAG,OAAO,CAAC,WAAW,CAAC,CAWjK"}
|
|
@@ -3,19 +3,14 @@
|
|
|
3
3
|
* Azure application credential helpers for authentication and token management.
|
|
4
4
|
* @module azureApplicationCredentials
|
|
5
5
|
* @category Services
|
|
6
|
+
* @hidden
|
|
6
7
|
*/
|
|
7
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
9
|
exports.getCurrentAccessToken = getCurrentAccessToken;
|
|
9
10
|
const identity_1 = require("@azure/identity");
|
|
10
11
|
const innerTokenCache = {};
|
|
11
12
|
/**
|
|
12
|
-
*
|
|
13
|
-
* If a valid token is cached, it will be returned; otherwise, a new token will be requested.
|
|
14
|
-
* @param tenantId - The tenant ID.
|
|
15
|
-
* @param clientId - The client ID.
|
|
16
|
-
* @param clientSecret - The client secret.
|
|
17
|
-
* @param scope - The scope for which the token is requested.
|
|
18
|
-
* @returns A promise that resolves to the access token.
|
|
13
|
+
* @deprecated
|
|
19
14
|
*/
|
|
20
15
|
async function getCurrentAccessToken(tenantId, clientId, clientSecret, scope) {
|
|
21
16
|
const cacheKey = createCacheKey(tenantId, clientId, scope);
|
|
@@ -7,23 +7,26 @@ import type { AccessToken } from "../models/AccessToken.ts";
|
|
|
7
7
|
import type { AccessTokenGenerator } from "../models/AccessTokenGenerator.ts";
|
|
8
8
|
import type { AzureClientId, AzureClientSecret, AzureTenantId, Scope } from "../models/AzureApplicationCredentials.ts";
|
|
9
9
|
import type { ContextRef } from "../models/Context.ts";
|
|
10
|
-
/** Create a context using
|
|
10
|
+
/** Create a context using a given access token generator. */
|
|
11
|
+
export declare function createContext(accessTokenGenerator: AccessTokenGenerator): ContextRef;
|
|
12
|
+
/**
|
|
13
|
+
* @deprecated Use `createContext(accessTokenGenerator)` instead.
|
|
14
|
+
*/
|
|
11
15
|
export declare function createClientSecretContext(tenantId: AzureTenantId, clientId: AzureClientId, clientSecret: AzureClientSecret, scope?: Scope): ContextRef;
|
|
12
16
|
/**
|
|
13
|
-
*
|
|
14
|
-
* @remarks You must manually handle renewal of the access token with this approach.
|
|
17
|
+
* @deprecated Use `createContext(accessTokenGenerator)` instead.
|
|
15
18
|
*/
|
|
16
19
|
export declare function createAccessTokenContext(accessToken: AccessToken): ContextRef;
|
|
17
|
-
/**
|
|
18
|
-
|
|
19
|
-
|
|
20
|
+
/**
|
|
21
|
+
* @deprecated Use `createContext(accessTokenGenerator)` instead.
|
|
22
|
+
*/
|
|
20
23
|
export declare function createDefaultClientSecretContext(): ContextRef;
|
|
21
24
|
/**
|
|
22
|
-
@deprecated Use `
|
|
25
|
+
@deprecated Use `createContext(accessTokenGenerator)` instead.
|
|
23
26
|
*/
|
|
24
27
|
export declare function getDefaultContextRef(): ContextRef;
|
|
25
28
|
/**
|
|
26
|
-
* @deprecated Use `
|
|
29
|
+
* @deprecated Use `createContext(accessTokenGenerator)` instead.
|
|
27
30
|
*/
|
|
28
31
|
export declare function register(tenantId: AzureTenantId, clientId: AzureClientId, clientSecret: AzureClientSecret): ContextRef;
|
|
29
32
|
//# sourceMappingURL=context.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../src/services/context.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AAC9E,OAAO,KAAK,EAAE,aAAa,EAAE,iBAAiB,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,0CAA0C,CAAC;AACvH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAOvD,
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../src/services/context.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AAC9E,OAAO,KAAK,EAAE,aAAa,EAAE,iBAAiB,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,0CAA0C,CAAC;AACvH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAOvD,6DAA6D;AAC7D,wBAAgB,aAAa,CAAC,oBAAoB,EAAE,oBAAoB,GAAG,UAAU,CAQpF;AAED;;GAEG;AACH,wBAAgB,yBAAyB,CAAC,QAAQ,EAAE,aAAa,EAAE,QAAQ,EAAE,aAAa,EAAE,YAAY,EAAE,iBAAiB,EAAE,KAAK,GAAE,KAAoB,GAAG,UAAU,CAMpK;AAED;;GAEG;AACH,wBAAgB,wBAAwB,CAAC,WAAW,EAAE,WAAW,GAAG,UAAU,CAI7E;AAED;;GAEG;AACH,wBAAgB,gCAAgC,IAAI,UAAU,CAM7D;AAED;;GAEG;AACH,wBAAgB,oBAAoB,IAAI,UAAU,CAEjD;AAED;;GAEG;AACH,wBAAgB,QAAQ,CAAC,QAAQ,EAAE,aAAa,EAAE,QAAQ,EAAE,aAAa,EAAE,YAAY,EAAE,iBAAiB,GAAG,UAAU,CAEtH"}
|
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
* @category Services
|
|
6
6
|
*/
|
|
7
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.createContext = createContext;
|
|
8
9
|
exports.createClientSecretContext = createClientSecretContext;
|
|
9
10
|
exports.createAccessTokenContext = createAccessTokenContext;
|
|
10
|
-
exports.createContext = createContext;
|
|
11
11
|
exports.createDefaultClientSecretContext = createDefaultClientSecretContext;
|
|
12
12
|
exports.getDefaultContextRef = getDefaultContextRef;
|
|
13
13
|
exports.register = register;
|
|
@@ -15,7 +15,18 @@ const azureApplicationCredentials_ts_1 = require("./azureApplicationCredentials.
|
|
|
15
15
|
const environmentVariable_ts_1 = require("./environmentVariable.js");
|
|
16
16
|
("../models/Scope.ts");
|
|
17
17
|
const defaultScope = "https://graph.microsoft.com/.default";
|
|
18
|
-
/** Create a context using
|
|
18
|
+
/** Create a context using a given access token generator. */
|
|
19
|
+
function createContext(accessTokenGenerator) {
|
|
20
|
+
const context = {
|
|
21
|
+
generateAccessToken: accessTokenGenerator,
|
|
22
|
+
};
|
|
23
|
+
return {
|
|
24
|
+
context,
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* @deprecated Use `createContext(accessTokenGenerator)` instead.
|
|
29
|
+
*/
|
|
19
30
|
function createClientSecretContext(tenantId, clientId, clientSecret, scope = defaultScope) {
|
|
20
31
|
const generateAccessToken = async () => {
|
|
21
32
|
return await (0, azureApplicationCredentials_ts_1.getCurrentAccessToken)(tenantId, clientId, clientSecret, scope);
|
|
@@ -23,24 +34,16 @@ function createClientSecretContext(tenantId, clientId, clientSecret, scope = def
|
|
|
23
34
|
return createContext(generateAccessToken);
|
|
24
35
|
}
|
|
25
36
|
/**
|
|
26
|
-
*
|
|
27
|
-
* @remarks You must manually handle renewal of the access token with this approach.
|
|
37
|
+
* @deprecated Use `createContext(accessTokenGenerator)` instead.
|
|
28
38
|
*/
|
|
29
39
|
function createAccessTokenContext(accessToken) {
|
|
30
40
|
return createContext(async () => {
|
|
31
41
|
return accessToken;
|
|
32
42
|
});
|
|
33
43
|
}
|
|
34
|
-
/**
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
generateAccessToken: accessTokenGenerator,
|
|
38
|
-
};
|
|
39
|
-
return {
|
|
40
|
-
context,
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
/** Create a context using the client secret credential using environment variables AZURE_TENANT_ID, AZURE_CLIENT_ID and AZURE_CLIENT_SECRET. */
|
|
44
|
+
/**
|
|
45
|
+
* @deprecated Use `createContext(accessTokenGenerator)` instead.
|
|
46
|
+
*/
|
|
44
47
|
function createDefaultClientSecretContext() {
|
|
45
48
|
const tenantId = (0, environmentVariable_ts_1.getEnvironmentVariable)("AZURE_TENANT_ID");
|
|
46
49
|
const clientId = (0, environmentVariable_ts_1.getEnvironmentVariable)("AZURE_CLIENT_ID");
|
|
@@ -48,13 +51,13 @@ function createDefaultClientSecretContext() {
|
|
|
48
51
|
return createClientSecretContext(tenantId, clientId, clientSecret);
|
|
49
52
|
}
|
|
50
53
|
/**
|
|
51
|
-
@deprecated Use `
|
|
54
|
+
@deprecated Use `createContext(accessTokenGenerator)` instead.
|
|
52
55
|
*/
|
|
53
56
|
function getDefaultContextRef() {
|
|
54
57
|
return createDefaultClientSecretContext();
|
|
55
58
|
}
|
|
56
59
|
/**
|
|
57
|
-
* @deprecated Use `
|
|
60
|
+
* @deprecated Use `createContext(accessTokenGenerator)` instead.
|
|
58
61
|
*/
|
|
59
62
|
function register(tenantId, clientId, clientSecret) {
|
|
60
63
|
return createClientSecretContext(tenantId, clientId, clientSecret);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"httpStatus.d.ts","sourceRoot":"","sources":["../../../src/services/httpStatus.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAErD;AAED;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAEhD;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAEtD;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAE7D;AAED;;;;GAIG;AACH,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAEhE;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAE5D;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAEpD;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAExD;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAE1D;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAE7D;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAEvD;AAED;;;;GAIG;AACH,wBAA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/services/operationInvoker.ts"],"names":[],"mappings":"AAmCA,OAAO,KAAK,EAAE,cAAc,EAAE,wBAAwB,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAiC/G;;;GAGG;AACH,eAAO,MAAM,QAAQ,qCAAqC,CAAC;AAE3D;;;GAGG;AACH,eAAO,MAAM,aAAa,4CAAuB,CAAC;AAElD;;;;;;;;GAQG;AACH,wBAAgB,SAAS,CAAC,CAAC,EAAE,UAAU,EAAE,wBAAwB,CAAC,CAAC,CAAC,GAAG,cAAc,CAAC,CAAC,CAAC,CAQvF;AAED;;;;;;;;GAQG;AACH,wBAAsB,QAAQ,CAAC,CAAC,SAAS,cAAc,CAAC,OAAO,CAAC,EAAE,EAAE,GAAG,UAAU,EAAE,CAAC,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,CAInH;AAED;;;;;;;;GAQG;AACH,wBAAsB,UAAU,CAAC,CAAC,SAAS,cAAc,CAAC,OAAO,CAAC,EAAE,EAAE,GAAG,UAAU,EAAE,CAAC,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,CAOrH;
|
|
1
|
+
{"version":3,"file":"operationInvoker.d.ts","sourceRoot":"","sources":["../../../src/services/operationInvoker.ts"],"names":[],"mappings":"AAmCA,OAAO,KAAK,EAAE,cAAc,EAAE,wBAAwB,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAiC/G;;;GAGG;AACH,eAAO,MAAM,QAAQ,qCAAqC,CAAC;AAE3D;;;GAGG;AACH,eAAO,MAAM,aAAa,4CAAuB,CAAC;AAElD;;;;;;;;GAQG;AACH,wBAAgB,SAAS,CAAC,CAAC,EAAE,UAAU,EAAE,wBAAwB,CAAC,CAAC,CAAC,GAAG,cAAc,CAAC,CAAC,CAAC,CAQvF;AAED;;;;;;;;GAQG;AACH,wBAAsB,QAAQ,CAAC,CAAC,SAAS,cAAc,CAAC,OAAO,CAAC,EAAE,EAAE,GAAG,UAAU,EAAE,CAAC,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,CAInH;AAED;;;;;;;;GAQG;AACH,wBAAsB,UAAU,CAAC,CAAC,SAAS,cAAc,CAAC,OAAO,CAAC,EAAE,EAAE,GAAG,UAAU,EAAE,CAAC,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,CAOrH;AAoND,wBAAgB,cAAc,CAAC,YAAY,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,KAAK,CAwE3E"}
|
|
@@ -168,7 +168,21 @@ async function innerFetch(request) {
|
|
|
168
168
|
let attempts = 0;
|
|
169
169
|
let errorLog = "";
|
|
170
170
|
while (true) {
|
|
171
|
-
|
|
171
|
+
try {
|
|
172
|
+
response = await (0, http_ts_1.executeHttpRequest)(request);
|
|
173
|
+
}
|
|
174
|
+
catch (error) {
|
|
175
|
+
const message = error instanceof Error ? error.message : error?.toString() || "Unknown error";
|
|
176
|
+
response = {
|
|
177
|
+
status: -1,
|
|
178
|
+
statusText: message,
|
|
179
|
+
headers: {},
|
|
180
|
+
data: null,
|
|
181
|
+
config: request,
|
|
182
|
+
request: null,
|
|
183
|
+
};
|
|
184
|
+
errorLog += message;
|
|
185
|
+
}
|
|
172
186
|
errorLog += requestToString(request);
|
|
173
187
|
errorLog += responseToString(response);
|
|
174
188
|
attempts++;
|
|
@@ -179,6 +193,9 @@ async function innerFetch(request) {
|
|
|
179
193
|
if (requestedRetryAfterSeconds) {
|
|
180
194
|
retryAfterMilliseconds = requestedRetryAfterSeconds * 1000;
|
|
181
195
|
}
|
|
196
|
+
else {
|
|
197
|
+
retryAfterMilliseconds += Math.random() * 1000; // Add some randomness to the retry delay to avoid thundering herd problem
|
|
198
|
+
}
|
|
182
199
|
errorLog += waitToString(retryAfterMilliseconds);
|
|
183
200
|
await (0, sleep_ts_1.sleep)(retryAfterMilliseconds);
|
|
184
201
|
retryAfterMilliseconds *= consecutiveRetryDelayMultiplier;
|
|
@@ -2,17 +2,12 @@
|
|
|
2
2
|
* Azure application credential helpers for authentication and token management.
|
|
3
3
|
* @module azureApplicationCredentials
|
|
4
4
|
* @category Services
|
|
5
|
+
* @hidden
|
|
5
6
|
*/
|
|
6
7
|
import type { AccessToken } from "../models/AccessToken.ts";
|
|
7
8
|
import type { AzureClientId, AzureClientSecret, AzureTenantId, Scope } from "../models/AzureApplicationCredentials.ts";
|
|
8
9
|
/**
|
|
9
|
-
*
|
|
10
|
-
* If a valid token is cached, it will be returned; otherwise, a new token will be requested.
|
|
11
|
-
* @param tenantId - The tenant ID.
|
|
12
|
-
* @param clientId - The client ID.
|
|
13
|
-
* @param clientSecret - The client secret.
|
|
14
|
-
* @param scope - The scope for which the token is requested.
|
|
15
|
-
* @returns A promise that resolves to the access token.
|
|
10
|
+
* @deprecated
|
|
16
11
|
*/
|
|
17
12
|
export declare function getCurrentAccessToken(tenantId: AzureTenantId, clientId: AzureClientId, clientSecret: AzureClientSecret, scope: Scope): Promise<AccessToken>;
|
|
18
13
|
//# sourceMappingURL=azureApplicationCredentials.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"azureApplicationCredentials.d.ts","sourceRoot":"","sources":["../../../src/services/azureApplicationCredentials.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"azureApplicationCredentials.d.ts","sourceRoot":"","sources":["../../../src/services/azureApplicationCredentials.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,KAAK,EAAE,aAAa,EAAE,iBAAiB,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,0CAA0C,CAAC;AAIvH;;GAEG;AACH,wBAAsB,qBAAqB,CAAC,QAAQ,EAAE,aAAa,EAAE,QAAQ,EAAE,aAAa,EAAE,YAAY,EAAE,iBAAiB,EAAE,KAAK,EAAE,KAAK,GAAG,OAAO,CAAC,WAAW,CAAC,CAWjK"}
|
|
@@ -2,17 +2,12 @@
|
|
|
2
2
|
* Azure application credential helpers for authentication and token management.
|
|
3
3
|
* @module azureApplicationCredentials
|
|
4
4
|
* @category Services
|
|
5
|
+
* @hidden
|
|
5
6
|
*/
|
|
6
7
|
import { ClientSecretCredential } from "@azure/identity";
|
|
7
8
|
const innerTokenCache = {};
|
|
8
9
|
/**
|
|
9
|
-
*
|
|
10
|
-
* If a valid token is cached, it will be returned; otherwise, a new token will be requested.
|
|
11
|
-
* @param tenantId - The tenant ID.
|
|
12
|
-
* @param clientId - The client ID.
|
|
13
|
-
* @param clientSecret - The client secret.
|
|
14
|
-
* @param scope - The scope for which the token is requested.
|
|
15
|
-
* @returns A promise that resolves to the access token.
|
|
10
|
+
* @deprecated
|
|
16
11
|
*/
|
|
17
12
|
export async function getCurrentAccessToken(tenantId, clientId, clientSecret, scope) {
|
|
18
13
|
const cacheKey = createCacheKey(tenantId, clientId, scope);
|
|
@@ -7,23 +7,26 @@ import type { AccessToken } from "../models/AccessToken.ts";
|
|
|
7
7
|
import type { AccessTokenGenerator } from "../models/AccessTokenGenerator.ts";
|
|
8
8
|
import type { AzureClientId, AzureClientSecret, AzureTenantId, Scope } from "../models/AzureApplicationCredentials.ts";
|
|
9
9
|
import type { ContextRef } from "../models/Context.ts";
|
|
10
|
-
/** Create a context using
|
|
10
|
+
/** Create a context using a given access token generator. */
|
|
11
|
+
export declare function createContext(accessTokenGenerator: AccessTokenGenerator): ContextRef;
|
|
12
|
+
/**
|
|
13
|
+
* @deprecated Use `createContext(accessTokenGenerator)` instead.
|
|
14
|
+
*/
|
|
11
15
|
export declare function createClientSecretContext(tenantId: AzureTenantId, clientId: AzureClientId, clientSecret: AzureClientSecret, scope?: Scope): ContextRef;
|
|
12
16
|
/**
|
|
13
|
-
*
|
|
14
|
-
* @remarks You must manually handle renewal of the access token with this approach.
|
|
17
|
+
* @deprecated Use `createContext(accessTokenGenerator)` instead.
|
|
15
18
|
*/
|
|
16
19
|
export declare function createAccessTokenContext(accessToken: AccessToken): ContextRef;
|
|
17
|
-
/**
|
|
18
|
-
|
|
19
|
-
|
|
20
|
+
/**
|
|
21
|
+
* @deprecated Use `createContext(accessTokenGenerator)` instead.
|
|
22
|
+
*/
|
|
20
23
|
export declare function createDefaultClientSecretContext(): ContextRef;
|
|
21
24
|
/**
|
|
22
|
-
@deprecated Use `
|
|
25
|
+
@deprecated Use `createContext(accessTokenGenerator)` instead.
|
|
23
26
|
*/
|
|
24
27
|
export declare function getDefaultContextRef(): ContextRef;
|
|
25
28
|
/**
|
|
26
|
-
* @deprecated Use `
|
|
29
|
+
* @deprecated Use `createContext(accessTokenGenerator)` instead.
|
|
27
30
|
*/
|
|
28
31
|
export declare function register(tenantId: AzureTenantId, clientId: AzureClientId, clientSecret: AzureClientSecret): ContextRef;
|
|
29
32
|
//# sourceMappingURL=context.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../src/services/context.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AAC9E,OAAO,KAAK,EAAE,aAAa,EAAE,iBAAiB,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,0CAA0C,CAAC;AACvH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAOvD,
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../src/services/context.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AAC9E,OAAO,KAAK,EAAE,aAAa,EAAE,iBAAiB,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,0CAA0C,CAAC;AACvH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAOvD,6DAA6D;AAC7D,wBAAgB,aAAa,CAAC,oBAAoB,EAAE,oBAAoB,GAAG,UAAU,CAQpF;AAED;;GAEG;AACH,wBAAgB,yBAAyB,CAAC,QAAQ,EAAE,aAAa,EAAE,QAAQ,EAAE,aAAa,EAAE,YAAY,EAAE,iBAAiB,EAAE,KAAK,GAAE,KAAoB,GAAG,UAAU,CAMpK;AAED;;GAEG;AACH,wBAAgB,wBAAwB,CAAC,WAAW,EAAE,WAAW,GAAG,UAAU,CAI7E;AAED;;GAEG;AACH,wBAAgB,gCAAgC,IAAI,UAAU,CAM7D;AAED;;GAEG;AACH,wBAAgB,oBAAoB,IAAI,UAAU,CAEjD;AAED;;GAEG;AACH,wBAAgB,QAAQ,CAAC,QAAQ,EAAE,aAAa,EAAE,QAAQ,EAAE,aAAa,EAAE,YAAY,EAAE,iBAAiB,GAAG,UAAU,CAEtH"}
|
|
@@ -7,7 +7,18 @@ import { getCurrentAccessToken } from "./azureApplicationCredentials.js";
|
|
|
7
7
|
import { getEnvironmentVariable } from "./environmentVariable.js";
|
|
8
8
|
("../models/Scope.ts");
|
|
9
9
|
const defaultScope = "https://graph.microsoft.com/.default";
|
|
10
|
-
/** Create a context using
|
|
10
|
+
/** Create a context using a given access token generator. */
|
|
11
|
+
export function createContext(accessTokenGenerator) {
|
|
12
|
+
const context = {
|
|
13
|
+
generateAccessToken: accessTokenGenerator,
|
|
14
|
+
};
|
|
15
|
+
return {
|
|
16
|
+
context,
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* @deprecated Use `createContext(accessTokenGenerator)` instead.
|
|
21
|
+
*/
|
|
11
22
|
export function createClientSecretContext(tenantId, clientId, clientSecret, scope = defaultScope) {
|
|
12
23
|
const generateAccessToken = async () => {
|
|
13
24
|
return await getCurrentAccessToken(tenantId, clientId, clientSecret, scope);
|
|
@@ -15,24 +26,16 @@ export function createClientSecretContext(tenantId, clientId, clientSecret, scop
|
|
|
15
26
|
return createContext(generateAccessToken);
|
|
16
27
|
}
|
|
17
28
|
/**
|
|
18
|
-
*
|
|
19
|
-
* @remarks You must manually handle renewal of the access token with this approach.
|
|
29
|
+
* @deprecated Use `createContext(accessTokenGenerator)` instead.
|
|
20
30
|
*/
|
|
21
31
|
export function createAccessTokenContext(accessToken) {
|
|
22
32
|
return createContext(async () => {
|
|
23
33
|
return accessToken;
|
|
24
34
|
});
|
|
25
35
|
}
|
|
26
|
-
/**
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
generateAccessToken: accessTokenGenerator,
|
|
30
|
-
};
|
|
31
|
-
return {
|
|
32
|
-
context,
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
/** Create a context using the client secret credential using environment variables AZURE_TENANT_ID, AZURE_CLIENT_ID and AZURE_CLIENT_SECRET. */
|
|
36
|
+
/**
|
|
37
|
+
* @deprecated Use `createContext(accessTokenGenerator)` instead.
|
|
38
|
+
*/
|
|
36
39
|
export function createDefaultClientSecretContext() {
|
|
37
40
|
const tenantId = getEnvironmentVariable("AZURE_TENANT_ID");
|
|
38
41
|
const clientId = getEnvironmentVariable("AZURE_CLIENT_ID");
|
|
@@ -40,13 +43,13 @@ export function createDefaultClientSecretContext() {
|
|
|
40
43
|
return createClientSecretContext(tenantId, clientId, clientSecret);
|
|
41
44
|
}
|
|
42
45
|
/**
|
|
43
|
-
@deprecated Use `
|
|
46
|
+
@deprecated Use `createContext(accessTokenGenerator)` instead.
|
|
44
47
|
*/
|
|
45
48
|
export function getDefaultContextRef() {
|
|
46
49
|
return createDefaultClientSecretContext();
|
|
47
50
|
}
|
|
48
51
|
/**
|
|
49
|
-
* @deprecated Use `
|
|
52
|
+
* @deprecated Use `createContext(accessTokenGenerator)` instead.
|
|
50
53
|
*/
|
|
51
54
|
export function register(tenantId, clientId, clientSecret) {
|
|
52
55
|
return createClientSecretContext(tenantId, clientId, clientS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CAAC,CAAC,CAAC,CAOrH;AAoND,wBAAgB,cAAc,CAAC,YAAY,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,KAAK,CAwE3E"}
|
|
@@ -158,7 +158,21 @@ async function innerFetch(request) {
|
|
|
158
158
|
let attempts = 0;
|
|
159
159
|
let errorLog = "";
|
|
160
160
|
while (true) {
|
|
161
|
-
|
|
161
|
+
try {
|
|
162
|
+
response = await executeHttpRequest(request);
|
|
163
|
+
}
|
|
164
|
+
catch (error) {
|
|
165
|
+
const message = error instanceof Error ? error.message : error?.toString() || "Unknown error";
|
|
166
|
+
response = {
|
|
167
|
+
status: -1,
|
|
168
|
+
statusText: message,
|
|
169
|
+
headers: {},
|
|
170
|
+
data: null,
|
|
171
|
+
config: request,
|
|
172
|
+
request: null,
|
|
173
|
+
};
|
|
174
|
+
errorLog += message;
|
|
175
|
+
}
|
|
162
176
|
errorLog += requestToString(request);
|
|
163
177
|
errorLog += responseToString(response);
|
|
164
178
|
attempts++;
|
|
@@ -169,6 +183,9 @@ async function innerFetch(request) {
|
|
|
169
183
|
if (requestedRetryAfterSeconds) {
|
|
170
184
|
retryAfterMilliseconds = requestedRetryAfterSeconds * 1000;
|
|
171
185
|
}
|
|
186
|
+
else {
|
|
187
|
+
retryAfterMilliseconds += Math.random() * 1000; // Add some randomness to the retry delay to avoid thundering herd problem
|
|
188
|
+
}
|
|
172
189
|
errorLog += waitToString(retryAfterMilliseconds);
|
|
173
190
|
await sleep(retryAfterMilliseconds);
|
|
174
191
|
retryAfterMilliseconds *= consecutiveRetryDelayMultiplier;
|
package/docs/api/README.md
CHANGED
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
| [AccessToken](AccessToken.md) | Token sent to server to authenticate a request. |
|
|
46
46
|
| [AccessTokenGenerator](AccessTokenGenerator.md) | Callback function that generates an access token. |
|
|
47
47
|
| [Address](Address.md) | Address of a set of cells in a spreadsheet. |
|
|
48
|
-
| [AzureApplicationCredentials](AzureApplicationCredentials
|
|
48
|
+
| [AzureApplicationCredentials](AzureApplicationCredentials.md) | Credentials used to authenticate an application with Azure. |
|
|
49
49
|
| [Border](Border.md) | Defining a border that could be on a cell. |
|
|
50
50
|
| [Cartesian](Cartesian.md) | Cartesian coordinates of a set of cells in a spreadsheet. |
|
|
51
51
|
| [Cell](Cell.md) | Cell in a worksheet. |
|
|
@@ -153,7 +153,6 @@
|
|
|
153
153
|
| ------ | ------ |
|
|
154
154
|
| [addressManipulation](addressManipulation.md) | Utilities for manipulating and analyzing spreadsheet-style addresses (A1 notation). |
|
|
155
155
|
| [addressOffset](addressOffset.md) | Utilities for converting between spreadsheet column/row addresses and offsets. |
|
|
156
|
-
| [azureApplicationCredentials](azureApplicationCredentials.md) | Azure application credential helpers for authentication and token management. |
|
|
157
156
|
| [batch](batch.md) | Constants and helpers for batching Microsoft Graph API requests. |
|
|
158
157
|
| [cartesianAddress](cartesianAddress.md) | Utilities for converting between A1 addresses and Cartesian coordinates. |
|
|
159
158
|
| [CellFormat](CellFormat.md) | Cell utilities. |
|
package/docs/api/context.md
CHANGED
|
@@ -6,13 +6,11 @@ Context creation and management utilities for Microsoft Graph API authentication
|
|
|
6
6
|
|
|
7
7
|
## Functions
|
|
8
8
|
|
|
9
|
-
### createAccessTokenContext()
|
|
9
|
+
### ~~createAccessTokenContext()~~
|
|
10
10
|
|
|
11
11
|
> **createAccessTokenContext**(`accessToken`): [`ContextRef`](Context-1.md#contextref)
|
|
12
12
|
|
|
13
|
-
Defined in: [src/services/context.ts:
|
|
14
|
-
|
|
15
|
-
Create a context using a static access token.
|
|
13
|
+
Defined in: [src/services/context.ts:42](https://github.com/Future-Secure-AI/microsoft-graph/blob/main/src/services/context.ts#L42)
|
|
16
14
|
|
|
17
15
|
#### Parameters
|
|
18
16
|
|
|
@@ -24,40 +22,42 @@ Create a context using a static access token.
|
|
|
24
22
|
|
|
25
23
|
[`ContextRef`](Context-1.md#contextref)
|
|
26
24
|
|
|
27
|
-
####
|
|
25
|
+
#### Deprecated
|
|
28
26
|
|
|
29
|
-
|
|
27
|
+
Use `createContext(accessTokenGenerator)` instead.
|
|
30
28
|
|
|
31
29
|
***
|
|
32
30
|
|
|
33
|
-
### createClientSecretContext()
|
|
31
|
+
### ~~createClientSecretContext()~~
|
|
34
32
|
|
|
35
33
|
> **createClientSecretContext**(`tenantId`, `clientId`, `clientSecret`, `scope`): [`ContextRef`](Context-1.md#contextref)
|
|
36
34
|
|
|
37
|
-
Defined in: [src/services/context.ts:
|
|
38
|
-
|
|
39
|
-
Create a context using the client secret credential.
|
|
35
|
+
Defined in: [src/services/context.ts:31](https://github.com/Future-Secure-AI/microsoft-graph/blob/main/src/services/context.ts#L31)
|
|
40
36
|
|
|
41
37
|
#### Parameters
|
|
42
38
|
|
|
43
39
|
| Parameter | Type | Default value |
|
|
44
40
|
| ------ | ------ | ------ |
|
|
45
|
-
| `tenantId` | [`AzureTenantId`](AzureApplicationCredentials
|
|
46
|
-
| `clientId` | [`AzureClientId`](AzureApplicationCredentials
|
|
47
|
-
| `clientSecret` | [`AzureClientSecret`](AzureApplicationCredentials
|
|
48
|
-
| `scope` | [`Scope`](AzureApplicationCredentials
|
|
41
|
+
| `tenantId` | [`AzureTenantId`](AzureApplicationCredentials.md#azuretenantid) | `undefined` |
|
|
42
|
+
| `clientId` | [`AzureClientId`](AzureApplicationCredentials.md#azureclientid) | `undefined` |
|
|
43
|
+
| `clientSecret` | [`AzureClientSecret`](AzureApplicationCredentials.md#azureclientsecret) | `undefined` |
|
|
44
|
+
| `scope` | [`Scope`](AzureApplicationCredentials.md#scope) | `defaultScope` |
|
|
49
45
|
|
|
50
46
|
#### Returns
|
|
51
47
|
|
|
52
48
|
[`ContextRef`](Context-1.md#contextref)
|
|
53
49
|
|
|
50
|
+
#### Deprecated
|
|
51
|
+
|
|
52
|
+
Use `createContext(accessTokenGenerator)` instead.
|
|
53
|
+
|
|
54
54
|
***
|
|
55
55
|
|
|
56
56
|
### createContext()
|
|
57
57
|
|
|
58
58
|
> **createContext**(`accessTokenGenerator`): [`ContextRef`](Context-1.md#contextref)
|
|
59
59
|
|
|
60
|
-
Defined in: [src/services/context.ts:
|
|
60
|
+
Defined in: [src/services/context.ts:18](https://github.com/Future-Secure-AI/microsoft-graph/blob/main/src/services/context.ts#L18)
|
|
61
61
|
|
|
62
62
|
Create a context using a given access token generator.
|
|
63
63
|
|
|
@@ -73,25 +73,27 @@ Create a context using a given access token generator.
|
|
|
73
73
|
|
|
74
74
|
***
|
|
75
75
|
|
|
76
|
-
### createDefaultClientSecretContext()
|
|
76
|
+
### ~~createDefaultClientSecretContext()~~
|
|
77
77
|
|
|
78
78
|
> **createDefaultClientSecretContext**(): [`ContextRef`](Context-1.md#contextref)
|
|
79
79
|
|
|
80
|
-
Defined in: [src/services/context.ts:
|
|
81
|
-
|
|
82
|
-
Create a context using the client secret credential using environment variables AZURE_TENANT_ID, AZURE_CLIENT_ID and AZURE_CLIENT_SECRET.
|
|
80
|
+
Defined in: [src/services/context.ts:51](https://github.com/Future-Secure-AI/microsoft-graph/blob/main/src/services/context.ts#L51)
|
|
83
81
|
|
|
84
82
|
#### Returns
|
|
85
83
|
|
|
86
84
|
[`ContextRef`](Context-1.md#contextref)
|
|
87
85
|
|
|
86
|
+
#### Deprecated
|
|
87
|
+
|
|
88
|
+
Use `createContext(accessTokenGenerator)` instead.
|
|
89
|
+
|
|
88
90
|
***
|
|
89
91
|
|
|
90
92
|
### ~~getDefaultContextRef()~~
|
|
91
93
|
|
|
92
94
|
> **getDefaultContextRef**(): [`ContextRef`](Context-1.md#contextref)
|
|
93
95
|
|
|
94
|
-
Defined in: [src/services/context.ts:
|
|
96
|
+
Defined in: [src/services/context.ts:62](https://github.com/Future-Secure-AI/microsoft-graph/blob/main/src/services/context.ts#L62)
|
|
95
97
|
|
|
96
98
|
#### Returns
|
|
97
99
|
|
|
@@ -99,7 +101,7 @@ Defined in: [src/services/context.ts:59](https://github.com/Future-Secure-AI/mic
|
|
|
99
101
|
|
|
100
102
|
#### Deprecated
|
|
101
103
|
|
|
102
|
-
Use `
|
|
104
|
+
Use `createContext(accessTokenGenerator)` instead.
|
|
103
105
|
|
|
104
106
|
***
|
|
105
107
|
|
|
@@ -107,15 +109,15 @@ Use `createDefaultClientSecretContext()` instead.
|
|
|
107
109
|
|
|
108
110
|
> **register**(`tenantId`, `clientId`, `clientSecret`): [`ContextRef`](Context-1.md#contextref)
|
|
109
111
|
|
|
110
|
-
Defined in: [src/services/context.ts:
|
|
112
|
+
Defined in: [src/services/context.ts:69](https://github.com/Future-Secure-AI/microsoft-graph/blob/main/src/services/context.ts#L69)
|
|
111
113
|
|
|
112
114
|
#### Parameters
|
|
113
115
|
|
|
114
116
|
| Parameter | Type |
|
|
115
117
|
| ------ | ------ |
|
|
116
|
-
| `tenantId` | [`AzureTenantId`](AzureApplicationCredentials
|
|
117
|
-
| `clientId` | [`AzureClientId`](AzureApplicationCredentials
|
|
118
|
-
| `clientSecret` | [`AzureClientSecret`](AzureApplicationCredentials
|
|
118
|
+
| `tenantId` | [`AzureTenantId`](AzureApplicationCredentials.md#azuretenantid) |
|
|
119
|
+
| `clientId` | [`AzureClientId`](AzureApplicationCredentials.md#azureclientid) |
|
|
120
|
+
| `clientSecret` | [`AzureClientSecret`](AzureApplicationCredentials.md#azureclientsecret) |
|
|
119
121
|
|
|
120
122
|
#### Returns
|
|
121
123
|
|
|
@@ -123,4 +125,4 @@ Defined in: [src/services/context.ts:66](https://github.com/Future-Secure-AI/mic
|
|
|
123
125
|
|
|
124
126
|
#### Deprecated
|
|
125
127
|
|
|
126
|
-
Use `
|
|
128
|
+
Use `createContext(accessTokenGenerator)` instead.
|
package/docs/api/drive.md
CHANGED
|
@@ -18,9 +18,9 @@ Creates a context with a reference to a drive.
|
|
|
18
18
|
|
|
19
19
|
| Parameter | Type |
|
|
20
20
|
| ------ | ------ |
|
|
21
|
-
| `tenantId` | [`AzureTenantId`](AzureApplicationCredentials
|
|
22
|
-
| `clientId` | [`AzureClientId`](AzureApplicationCredentials
|
|
23
|
-
| `clientSecret` | [`AzureClientSecret`](AzureApplicationCredentials
|
|
21
|
+
| `tenantId` | [`AzureTenantId`](AzureApplicationCredentials.md#azuretenantid) |
|
|
22
|
+
| `clientId` | [`AzureClientId`](AzureApplicationCredentials.md#azureclientid) |
|
|
23
|
+
| `clientSecret` | [`AzureClientSecret`](AzureApplicationCredentials.md#azureclientsecret) |
|
|
24
24
|
| `siteId` | [`SiteId`](Site-1.md#siteid) |
|
|
25
25
|
| `driveId` | [`DriveId`](Drive-1.md#driveid) |
|
|
26
26
|
|
|
@@ -100,7 +100,7 @@ The responses for each operation, in the same order.
|
|
|
100
100
|
|
|
101
101
|
> **throwException**(`responseCode`, `message`): `never`
|
|
102
102
|
|
|
103
|
-
Defined in: [src/services/operationInvoker.ts:
|
|
103
|
+
Defined in: [src/services/operationInvoker.ts:343](https://github.com/Future-Secure-AI/microsoft-graph/blob/main/src/services/operationInvoker.ts#L343)
|
|
104
104
|
|
|
105
105
|
#### Parameters
|
|
106
106
|
|
package/package.json
CHANGED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
[Microsoft Graph SDK](README.md) / azureApplicationCredentials
|
|
2
|
-
|
|
3
|
-
# azureApplicationCredentials
|
|
4
|
-
|
|
5
|
-
Azure application credential helpers for authentication and token management.
|
|
6
|
-
|
|
7
|
-
## Functions
|
|
8
|
-
|
|
9
|
-
### getCurrentAccessToken()
|
|
10
|
-
|
|
11
|
-
> **getCurrentAccessToken**(`tenantId`, `clientId`, `clientSecret`, `scope`): [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`AccessToken`](AccessToken.md#accesstoken)\>
|
|
12
|
-
|
|
13
|
-
Defined in: [src/services/azureApplicationCredentials.ts:22](https://github.com/Future-Secure-AI/microsoft-graph/blob/main/src/services/azureApplicationCredentials.ts#L22)
|
|
14
|
-
|
|
15
|
-
Retrieves the current access token for a given client and scope.
|
|
16
|
-
If a valid token is cached, it will be returned; otherwise, a new token will be requested.
|
|
17
|
-
|
|
18
|
-
#### Parameters
|
|
19
|
-
|
|
20
|
-
| Parameter | Type | Description |
|
|
21
|
-
| ------ | ------ | ------ |
|
|
22
|
-
| `tenantId` | [`AzureTenantId`](AzureApplicationCredentials-1.md#azuretenantid) | The tenant ID. |
|
|
23
|
-
| `clientId` | [`AzureClientId`](AzureApplicationCredentials-1.md#azureclientid) | The client ID. |
|
|
24
|
-
| `clientSecret` | [`AzureClientSecret`](AzureApplicationCredentials-1.md#azureclientsecret) | The client secret. |
|
|
25
|
-
| `scope` | [`Scope`](AzureApplicationCredentials-1.md#scope) | The scope for which the token is requested. |
|
|
26
|
-
|
|
27
|
-
#### Returns
|
|
28
|
-
|
|
29
|
-
[`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`AccessToken`](AccessToken.md#accesstoken)\>
|
|
30
|
-
|
|
31
|
-
A promise that resolves to the access token.
|
|
File without changes
|