@microsoft/teamsfx 2.2.3-alpha.dea6b9e8a.0 → 2.2.3-alpha.e58796e43.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/README.md +165 -115
- package/dist/index.esm2017.js +22 -0
- package/dist/index.esm2017.js.map +1 -1
- package/dist/index.esm2017.mjs +63 -7
- package/dist/index.esm2017.mjs.map +1 -1
- package/dist/index.esm5.js +52 -1
- package/dist/index.esm5.js.map +1 -1
- package/dist/index.node.cjs.js +184 -118
- package/dist/index.node.cjs.js.map +1 -1
- package/package.json +26 -10
- package/types/teamsfx.d.ts +27 -4
package/README.md
CHANGED
@@ -21,7 +21,8 @@ Please check the [README](https://github.com/OfficeDev/TeamsFx/blob/main/package
|
|
21
21
|
|
22
22
|
### Prerequisites
|
23
23
|
|
24
|
-
- Node.js version
|
24
|
+
- Node.js version 18 or higher
|
25
|
+
- PNPM version 8 or higher
|
25
26
|
- A project created by the Teams Toolkit VS Code extension or `teamsfx` CLI tool.
|
26
27
|
- If your project has installed `botbuilder` related [packages](https://github.com/Microsoft/botbuilder-js#packages) as dependencies, ensure they are of the same version and the version `>= 4.18.0`. ([Issue - all of the BOTBUILDER packages should be the same version](https://github.com/BotBuilderCommunity/botbuilder-community-js/issues/57#issuecomment-508538548))
|
27
28
|
|
@@ -43,22 +44,43 @@ TeamsFx SDK is built to be used in browser and NodeJS environment. Common scenar
|
|
43
44
|
|
44
45
|
### Create and authenticate a service using `createMicrosoftGraphClientWithCredential` or `createMicrosoftGraphClient`
|
45
46
|
|
46
|
-
> [!NOTE] `createMicrosoftGraphClient` function has been deprecated. It is recommended that you to use `
|
47
|
+
> [!NOTE] `createMicrosoftGraphClient` and `createMicrosoftGraphClientWithCredential` function has been deprecated. It is recommended that you to use `Client` and `TokenCredentialAuthenticationProvider` from `@microsoft/microsoft-graph-client` instead, for better coding experience.
|
47
48
|
|
48
49
|
To create a graph client object to access the Microsoft Graph API, you will need the credential to do authentication. The SDK provides APIs to configure for developers. Please choose the proper identity type and follow below steps:
|
49
50
|
|
50
51
|
#### Invoke Graph API on behalf of Teams User (User Identity)
|
51
52
|
|
52
53
|
Use the snippet below (Recommended):
|
54
|
+
|
53
55
|
```ts
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
};
|
56
|
+
import { TeamsUserCredentialAuthConfig, TeamsUserCredential } from "@microsoft/teamsfx";
|
57
|
+
import { Client } from "@microsoft/microsoft-graph-client";
|
58
|
+
import { TokenCredentialAuthenticationProvider } from "@microsoft/microsoft-graph-client/authProviders/azureTokenCredentials";
|
58
59
|
|
59
|
-
|
60
|
-
|
61
|
-
|
60
|
+
const authConfig: TeamsUserCredentialAuthConfig = {
|
61
|
+
clientId: process.env.REACT_APP_CLIENT_ID,
|
62
|
+
initiateLoginEndpoint: process.env.REACT_APP_START_LOGIN_PAGE_URL,
|
63
|
+
};
|
64
|
+
|
65
|
+
const teamsUserCredential = new TeamsUserCredential(authConfig);
|
66
|
+
const authProvider = new TokenCredentialAuthenticationProvider(credential, {
|
67
|
+
scopes: ["User.Read"],
|
68
|
+
});
|
69
|
+
const graphClient = Client.initWithMiddleware({ authProvider: authProvider });
|
70
|
+
const profile = await graphClient.api("/me").get();
|
71
|
+
```
|
72
|
+
|
73
|
+
or use `createMicrosoftGraphClientWithCredential` as below (Deprecated):
|
74
|
+
|
75
|
+
```ts
|
76
|
+
const authConfig: TeamsUserCredentialAuthConfig = {
|
77
|
+
clientId: process.env.REACT_APP_CLIENT_ID,
|
78
|
+
initiateLoginEndpoint: process.env.REACT_APP_START_LOGIN_PAGE_URL,
|
79
|
+
};
|
80
|
+
|
81
|
+
const teamsUserCredential = new TeamsUserCredential(authConfig);
|
82
|
+
const graphClient = createMicrosoftGraphClientWithCredential(teamsUserCredential, ["User.Read"]);
|
83
|
+
const profile = await graphClient.api("/me").get();
|
62
84
|
```
|
63
85
|
|
64
86
|
or use `createMicrosoftGraphClient` as below (Deprecated):
|
@@ -79,12 +101,35 @@ const profile = await graphClient.api("/me").get(); // Get the profile of curren
|
|
79
101
|
It doesn't require the interaction with Teams user. You can call Microsoft Graph as application identity.
|
80
102
|
|
81
103
|
Use the snippet below (Recommended):
|
104
|
+
|
82
105
|
```ts
|
106
|
+
import { AppCredentialAuthConfig, AppCredential } from "@microsoft/teamsfx";
|
107
|
+
import { Client } from "@microsoft/microsoft-graph-client";
|
108
|
+
import { TokenCredentialAuthenticationProvider } from "@microsoft/microsoft-graph-client/authProviders/azureTokenCredentials";
|
109
|
+
|
83
110
|
const appAuthConfig: AppCredentialAuthConfig = {
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
111
|
+
authorityHost: process.env.M365_AUTHORITY_HOST,
|
112
|
+
clientId: process.env.M365_CLIENT_ID,
|
113
|
+
tenantId: process.env.M365_TENANT_ID,
|
114
|
+
clientSecret: process.env.M365_CLIENT_SECRET,
|
115
|
+
};
|
116
|
+
|
117
|
+
const appCredential = new AppCredential(appAuthConfig);
|
118
|
+
const authProvider = new TokenCredentialAuthenticationProvider(appCredential, {
|
119
|
+
scopes: ["https://graph.microsoft.com/.default"],
|
120
|
+
});
|
121
|
+
const graphClient = Client.initWithMiddleware({ authProvider: authProvider });
|
122
|
+
const profile = await graphClient.api("/users/{object_id_of_another_people}").get();
|
123
|
+
```
|
124
|
+
|
125
|
+
or use `createMicrosoftGraphClientWithCredential` as below (Deprecated):
|
126
|
+
|
127
|
+
```ts
|
128
|
+
const appAuthConfig: AppCredentialAuthConfig = {
|
129
|
+
authorityHost: process.env.M365_AUTHORITY_HOST,
|
130
|
+
clientId: process.env.M365_CLIENT_ID,
|
131
|
+
tenantId: process.env.M365_TENANT_ID,
|
132
|
+
clientSecret: process.env.M365_CLIENT_SECRET,
|
88
133
|
};
|
89
134
|
|
90
135
|
const appCredential = new AppCredential(appAuthConfig);
|
@@ -109,7 +154,7 @@ const profile = await graphClient.api("/users/{object_id_of_another_people}").ge
|
|
109
154
|
|
110
155
|
### TeamsFx class
|
111
156
|
|
112
|
-
> [!NOTE] `TeamsFx` class has been deprecated. It is recommended that you to use different credentials (`TeamsUserCredential`, `AppCredential`,
|
157
|
+
> [!NOTE] `TeamsFx` class has been deprecated. It is recommended that you to use different credentials (`TeamsUserCredential`, `AppCredential`, `OnBehalfOfUserCredential`) instead, for better coding experience.
|
113
158
|
|
114
159
|
`TeamsFx` class instance reads all TeamsFx settings from environment variables by default. You can also set customized configuration values to override the default values. Please check [Override configuration](#override-configuration) for details.
|
115
160
|
|
@@ -146,6 +191,7 @@ Here's the corresponding scenarios that each credential class targets.
|
|
146
191
|
`TeamsUserCredential` represents Teams current user's identity. Using this credential will request user consent at the first time. It leverages the Teams SSO and On-Behalf-Of flow to do token exchange. SDK uses this credential when developer choose "User" identity in browser environment.
|
147
192
|
|
148
193
|
The following code is an an example to create TeamsUserCredential:
|
194
|
+
|
149
195
|
```ts
|
150
196
|
const authConfig: TeamsUserCredentialAuthConfig = {
|
151
197
|
clientId: process.env.REACT_APP_CLIENT_ID,
|
@@ -162,6 +208,7 @@ Required configurations are initiateLoginEndpoint and clientId which can be foun
|
|
162
208
|
`OnBehalfOfUserCredential` uses On-Behalf-Of flow and need Teams ssoToken. It's designed to be used in Azure Function or Bot scenarios. SDK uses this credential when developer choose "User" identity in NodeJS environment.
|
163
209
|
|
164
210
|
The following code is an example to create OnBehalfOfUserCredential:
|
211
|
+
|
165
212
|
```ts
|
166
213
|
const oboAuthConfig: OnBehalfOfCredentialAuthConfig = {
|
167
214
|
authorityHost: process.env.M365_AUTHORITY_HOST,
|
@@ -179,7 +226,6 @@ Required configurations are authorityHost, tenantId, clientId, clientSecret, or
|
|
179
226
|
|
180
227
|
`AppCredential` represents the application identity. It is usually used when user is not involved like time-triggered automation job. SDK uses this credential when developer choose "App" identity in NodeJS environment.
|
181
228
|
|
182
|
-
|
183
229
|
The following code is an example to create `AppCredential`:
|
184
230
|
|
185
231
|
```ts
|
@@ -227,7 +273,7 @@ TeamsFx SDK provides several helper functions to ease the configuration for thir
|
|
227
273
|
|
228
274
|
#### Microsoft Graph Service
|
229
275
|
|
230
|
-
`createMicrosoftGraphClientWithCredential`, `createMicrosoftGraphClient`
|
276
|
+
`createMicrosoftGraphClientWithCredential`, `createMicrosoftGraphClient` and `MsGraphAuthProvider` help to create authenticated Graph instance. These are now deprecated, we recommend you to use Microsoft Graph SDKs instead.
|
231
277
|
|
232
278
|
#### SQL
|
233
279
|
|
@@ -251,7 +297,7 @@ try {
|
|
251
297
|
initiateLoginEndpoint: process.env.REACT_APP_START_LOGIN_PAGE_URL,
|
252
298
|
};
|
253
299
|
|
254
|
-
const credential = new TeamsUserCredential(authConfig);
|
300
|
+
const credential = new TeamsUserCredential(authConfig);
|
255
301
|
await credential.login("User.Read");
|
256
302
|
} catch (err: unknown) {
|
257
303
|
if (err instanceof ErrorWithCode && err.code !== ErrorCode.ConsentFailed) {
|
@@ -272,8 +318,11 @@ try {
|
|
272
318
|
initiateLoginEndpoint: process.env.REACT_APP_START_LOGIN_PAGE_URL,
|
273
319
|
};
|
274
320
|
|
275
|
-
const credential = new TeamsUserCredential(authConfig);
|
276
|
-
const
|
321
|
+
const credential = new TeamsUserCredential(authConfig);
|
322
|
+
const authProvider = new TokenCredentialAuthenticationProvider(credential, {
|
323
|
+
scopes: ["User.Read"],
|
324
|
+
});
|
325
|
+
const graphClient = Client.initWithMiddleware({ authProvider: authProvider });
|
277
326
|
const profile = await graphClient.api("/me").get();
|
278
327
|
} catch (err: unknown) {
|
279
328
|
// ErrorWithCode is handled by Graph client
|
@@ -297,7 +346,7 @@ The following sections provide several code snippets covering some of the most c
|
|
297
346
|
|
298
347
|
### Use Graph API in tab app
|
299
348
|
|
300
|
-
Use `createMicrosoftGraphClientWithCredential`.
|
349
|
+
Use `createMicrosoftGraphClientWithCredential`. Thie API is now deprecated, we recommend you to use `Client` and `TokenCredentialAuthenticationProvider` from Microsoft Graph SDKs (`@microsoft/microsoft-graph-client`) instead.
|
301
350
|
|
302
351
|
```ts
|
303
352
|
const authConfig: TeamsUserCredentialAuthConfig = {
|
@@ -311,15 +360,14 @@ const teamsUserCredential = new TeamsUserCredential(authConfig);
|
|
311
360
|
await teamsUserCredential.login(["User.Read"]); // Login with scope
|
312
361
|
|
313
362
|
try {
|
314
|
-
|
315
|
-
|
363
|
+
const graphClient = createMicrosoftGraphClientWithCredential(teamsUserCredential, ["User. Read"]); // Initializes MS Graph SDK using our MsGraphAuthProvider
|
364
|
+
const profile = await graphClient.api("/me").get();
|
316
365
|
} catch (err: unknown) {
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
366
|
+
// ErrorWithCode is handled by Graph client
|
367
|
+
if (err instanceof GraphError && err.code?.includes(ErrorCode.UiRequiredError)) {
|
368
|
+
// Need to show login button to ask for user consent.
|
369
|
+
}
|
321
370
|
}
|
322
|
-
|
323
371
|
```
|
324
372
|
|
325
373
|
### Call Azure Function in tab app
|
@@ -333,7 +381,7 @@ async function callFunction() {
|
|
333
381
|
initiateLoginEndpoint: process.env.REACT_APP_START_LOGIN_PAGE_URL,
|
334
382
|
};
|
335
383
|
const teamsUserCredential = new TeamsUserCredential(authConfig);
|
336
|
-
const accessToken = await teamsUserCredential.getToken(""); // Get SSO token
|
384
|
+
const accessToken = await teamsUserCredential.getToken(""); // Get SSO token
|
337
385
|
const endpoint = "https://YOUR_API_ENDPOINT";
|
338
386
|
const response = await axios.default.get(endpoint + "/api/" + functionName, {
|
339
387
|
headers: {
|
@@ -341,7 +389,7 @@ async function callFunction() {
|
|
341
389
|
},
|
342
390
|
});
|
343
391
|
return response.data;
|
344
|
-
}
|
392
|
+
}
|
345
393
|
```
|
346
394
|
|
347
395
|
### Access SQL database in Azure Function
|
@@ -378,10 +426,10 @@ const appAuthConfig: AppCredentialAuthConfig = {
|
|
378
426
|
authorityHost: process.env.M365_AUTHORITY_HOST,
|
379
427
|
clientId: process.env.M365_CLIENT_ID,
|
380
428
|
tenantId: process.env.M365_TENANT_ID,
|
381
|
-
certificateContent:
|
429
|
+
certificateContent: "PEM-encoded key certificate",
|
382
430
|
};
|
383
431
|
const appCredential = new AppCredential(appAuthConfig);
|
384
|
-
const token = appCredential.getToken();
|
432
|
+
const token = appCredential.getToken();
|
385
433
|
```
|
386
434
|
|
387
435
|
### Use Graph API in Bot application
|
@@ -391,7 +439,11 @@ Add `TeamsBotSsoPrompt` to dialog set.
|
|
391
439
|
```ts
|
392
440
|
const { ConversationState, MemoryStorage } = require("botbuilder");
|
393
441
|
const { DialogSet, WaterfallDialog } = require("botbuilder-dialogs");
|
394
|
-
const {
|
442
|
+
const {
|
443
|
+
TeamsBotSsoPrompt,
|
444
|
+
OnBehalfOfCredentialAuthConfig,
|
445
|
+
TeamsBotSsoPromptSettings,
|
446
|
+
} = require("@microsoft/teamsfx");
|
395
447
|
|
396
448
|
const convoState = new ConversationState(new MemoryStorage());
|
397
449
|
const dialogState = convoState.createProperty("dialogState");
|
@@ -400,16 +452,16 @@ const dialogs = new DialogSet(dialogState);
|
|
400
452
|
const TeamsBotSsoPromptId = "TEAMS_BOT_SSO_PROMPT";
|
401
453
|
|
402
454
|
const settings: TeamsBotSsoPromptSettings = {
|
403
|
-
scopes: ["User.Read"],
|
404
|
-
timeout: 900000,
|
405
|
-
endOnInvalidMessage: true,
|
455
|
+
scopes: ["User.Read"],
|
456
|
+
timeout: 900000,
|
457
|
+
endOnInvalidMessage: true,
|
406
458
|
};
|
407
459
|
|
408
460
|
const authConfig: OnBehalfOfCredentialAuthConfig = {
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
|
461
|
+
authorityHost: process.env.M365_AUTHORITY_HOST,
|
462
|
+
clientId: process.env.M365_CLIENT_ID,
|
463
|
+
tenantId: process.env.M365_TENANT_ID,
|
464
|
+
clientSecret: process.env.M365_CLIENT_SECRET,
|
413
465
|
};
|
414
466
|
const loginUrl = process.env.INITIATE_LOGIN_ENDPOINT;
|
415
467
|
const ssoPrompt = new TeamsBotSsoPrompt(authConfig, loginUrl, TeamsBotSsoPromptId, settings);
|
@@ -546,94 +598,92 @@ Also see [Credential](#Credential) for furthur description.
|
|
546
598
|
|
547
599
|
From `botbuilder@4.16.0`, `BotFrameworkAdapter` is deprecated, and `CloudAdapter` is recommended to be used instead. You can import `ConversationBot` from `BotBuilderCloudAdapter` to use the latest SDK implemented with `CloudAdapter`.
|
548
600
|
|
549
|
-
1. Install `@microsoft/teamsfx @^2.2.0`, `botbuilder @^4.18.0`, (and `@types/node @^
|
601
|
+
1. Install `@microsoft/teamsfx @^2.2.0`, `botbuilder @^4.18.0`, (and `@types/node @^18.0.0` for TS projects) via `npm install` as follows.
|
602
|
+
|
603
|
+
```sh
|
604
|
+
npm install @microsoft/teamsfx
|
605
|
+
npm install botbuilder
|
550
606
|
|
551
|
-
|
552
|
-
|
553
|
-
|
554
|
-
|
555
|
-
// For TS projects only
|
556
|
-
npm install --save-dev @types/node
|
557
|
-
```
|
607
|
+
// For TS projects only
|
608
|
+
npm install --save-dev @types/node
|
609
|
+
```
|
558
610
|
|
559
611
|
2. Update the import of `ConversationBot` and create a new `ConversationBot` as follows.
|
560
612
|
|
561
|
-
|
562
|
-
|
563
|
-
|
564
|
-
|
565
|
-
|
566
|
-
|
567
|
-
|
568
|
-
|
569
|
-
|
570
|
-
|
571
|
-
|
572
|
-
|
573
|
-
|
574
|
-
|
575
|
-
|
576
|
-
|
577
|
-
|
578
|
-
|
579
|
-
|
580
|
-
|
613
|
+
```ts
|
614
|
+
import { HelloWorldCommandHandler } from "../helloworldCommandHandler";
|
615
|
+
import { BotBuilderCloudAdapter } from "@microsoft/teamsfx";
|
616
|
+
import ConversationBot = BotBuilderCloudAdapter.ConversationBot;
|
617
|
+
import config from "./config";
|
618
|
+
|
619
|
+
export const commandBot = new ConversationBot({
|
620
|
+
// The bot id and password to create CloudAdapter.
|
621
|
+
// See https://aka.ms/about-bot-adapter to learn more about adapters.
|
622
|
+
adapterConfig: {
|
623
|
+
MicrosoftAppId: config.botId,
|
624
|
+
MicrosoftAppPassword: config.botPassword,
|
625
|
+
MicrosoftAppType: "MultiTenant",
|
626
|
+
},
|
627
|
+
command: {
|
628
|
+
enabled: true,
|
629
|
+
commands: [new HelloWorldCommandHandler()],
|
630
|
+
},
|
631
|
+
});
|
632
|
+
```
|
581
633
|
|
582
634
|
3. If the project is using `restify` to create a server, please add the following line after `restify.createServer()`.
|
583
635
|
|
584
|
-
|
585
|
-
|
586
|
-
|
636
|
+
```ts
|
637
|
+
server.use(restify.plugins.bodyParser());
|
638
|
+
```
|
587
639
|
|
588
|
-
|
640
|
+
The complete code will be like
|
589
641
|
|
590
|
-
|
591
|
-
|
592
|
-
|
593
|
-
|
594
|
-
|
595
|
-
|
596
|
-
|
597
|
-
|
642
|
+
```ts
|
643
|
+
// Create HTTP server.
|
644
|
+
const server = restify.createServer();
|
645
|
+
server.use(restify.plugins.bodyParser());
|
646
|
+
server.listen(process.env.port || process.env.PORT || 3978, () => {
|
647
|
+
console.log(`\nApp Started, ${server.name} listening to ${server.url}`);
|
648
|
+
});
|
649
|
+
```
|
598
650
|
|
599
651
|
4. If the project has `responseWrapper.ts`, please update the class `responseWrapper` to the class below.
|
600
652
|
|
601
|
-
|
602
|
-
|
603
|
-
|
604
|
-
|
605
|
-
|
606
|
-
|
607
|
-
|
608
|
-
|
609
|
-
|
610
|
-
|
611
|
-
|
612
|
-
|
613
|
-
|
614
|
-
|
615
|
-
|
616
|
-
|
617
|
-
|
618
|
-
|
619
|
-
|
620
|
-
|
621
|
-
|
622
|
-
|
623
|
-
|
624
|
-
|
625
|
-
|
626
|
-
|
627
|
-
|
628
|
-
|
629
|
-
|
630
|
-
|
631
|
-
|
632
|
-
|
633
|
-
|
634
|
-
|
635
|
-
|
636
|
-
|
653
|
+
```ts
|
654
|
+
import { Response } from "botbuilder";
|
655
|
+
|
656
|
+
// A wrapper to convert Azure Functions Response to Bot Builder's Response.
|
657
|
+
export class ResponseWrapper implements Response {
|
658
|
+
socket: any;
|
659
|
+
originalResponse?: any;
|
660
|
+
headers?: any;
|
661
|
+
body?: any;
|
662
|
+
|
663
|
+
constructor(functionResponse?: { [key: string]: any }) {
|
664
|
+
this.socket = undefined;
|
665
|
+
this.originalResponse = functionResponse;
|
666
|
+
}
|
667
|
+
|
668
|
+
end(...args: any[]) {
|
669
|
+
// do nothing since res.end() is deprecated in Azure Functions.
|
670
|
+
}
|
671
|
+
|
672
|
+
header(name: string, value: any) {
|
673
|
+
this.headers[name] = value;
|
674
|
+
}
|
675
|
+
|
676
|
+
send(body: any) {
|
677
|
+
// record the body to be returned later.
|
678
|
+
this.body = body;
|
679
|
+
this.originalResponse.body = body;
|
680
|
+
}
|
681
|
+
status(status: number) {
|
682
|
+
// call Azure Functions' res.status().
|
683
|
+
return this.originalResponse?.status(status);
|
684
|
+
}
|
685
|
+
}
|
686
|
+
```
|
637
687
|
|
638
688
|
## Next steps
|
639
689
|
|
package/dist/index.esm2017.js
CHANGED
@@ -788,8 +788,10 @@ class TeamsUserCredential {
|
|
788
788
|
|
789
789
|
// Copyright (c) Microsoft Corporation.
|
790
790
|
const defaultScope = "https://graph.microsoft.com/.default";
|
791
|
+
// eslint-disable-next-line no-secrets/no-secrets
|
791
792
|
/**
|
792
793
|
* Microsoft Graph auth provider for Teams Framework
|
794
|
+
* @deprecated Use `TokenCredentialAuthenticationProvider` from `@microsoft/microsoft-graph-client/authProviders/azureTokenCredentials` instead.
|
793
795
|
*/
|
794
796
|
class MsGraphAuthProvider {
|
795
797
|
constructor(credentialOrTeamsFx, scopes) {
|
@@ -844,6 +846,14 @@ class MsGraphAuthProvider {
|
|
844
846
|
// Copyright (c) Microsoft Corporation.
|
845
847
|
/**
|
846
848
|
* Get Microsoft graph client.
|
849
|
+
* @deprecated Use `TokenCredentialAuthenticationProvider` and `Client.initWithMiddleware` instead.
|
850
|
+
* ```typescript
|
851
|
+
* const authProvider = new TokenCredentialAuthenticationProvider(credential, { scopes: scope });
|
852
|
+
* const graph = Client.initWithMiddleware({
|
853
|
+
* authProvider: authProvider,
|
854
|
+
* });
|
855
|
+
* ```
|
856
|
+
*
|
847
857
|
* @example
|
848
858
|
* Get Microsoft graph client by TokenCredential
|
849
859
|
* ```typescript
|
@@ -901,6 +911,14 @@ function createMicrosoftGraphClient(teamsfx, scopes) {
|
|
901
911
|
// eslint-disable-next-line no-secrets/no-secrets
|
902
912
|
/**
|
903
913
|
* Get Microsoft graph client.
|
914
|
+
* @deprecated Use `TokenCredentialAuthenticationProvider` and `Client.initWithMiddleware` instead.
|
915
|
+
* ```typescript
|
916
|
+
* const authProvider = new TokenCredentialAuthenticationProvider(credential, { scopes: scope });
|
917
|
+
* const graph = Client.initWithMiddleware({
|
918
|
+
* authProvider: authProvider,
|
919
|
+
* });
|
920
|
+
* ```
|
921
|
+
*
|
904
922
|
* @example
|
905
923
|
* Get Microsoft graph client by TokenCredential
|
906
924
|
* ```typescript
|
@@ -1290,6 +1308,8 @@ var IdentityType;
|
|
1290
1308
|
// Copyright (c) Microsoft Corporation.
|
1291
1309
|
/**
|
1292
1310
|
* A class providing credential and configuration.
|
1311
|
+
* @deprecated Please use {@link TeamsUserCredential}
|
1312
|
+
* in browser environment and {@link OnBehalfOfUserCredential} or {@link AppCredential} in NodeJS.
|
1293
1313
|
*/
|
1294
1314
|
class TeamsFx {
|
1295
1315
|
constructor(identityType, customConfig) {
|
@@ -1987,8 +2007,10 @@ class CardActionBot$1 {
|
|
1987
2007
|
}
|
1988
2008
|
}
|
1989
2009
|
|
2010
|
+
// eslint-disable-next-line no-secrets/no-secrets
|
1990
2011
|
/**
|
1991
2012
|
* Users execute query with SSO or Access Token.
|
2013
|
+
* @deprecated
|
1992
2014
|
* @remarks
|
1993
2015
|
* Only works in in server side.
|
1994
2016
|
*/
|