@microsoft/teamsfx 0.5.1 → 0.5.2-alpha.0535e2d27.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.
@@ -9,6 +9,73 @@ import { GetTokenOptions } from '@azure/identity';
9
9
  import { TokenCredential } from '@azure/identity';
10
10
  import { TokenResponse } from 'botframework-schema';
11
11
 
12
+ /**
13
+ * Represent Microsoft 365 tenant identity, and it is usually used when user is not involved like time-triggered automation job.
14
+ *
15
+ * @example
16
+ * ```typescript
17
+ * loadConfiguration(); // load configuration from environment variables
18
+ * const credential = new AppCredential();
19
+ * ```
20
+ *
21
+ * @remarks
22
+ * Only works in in server side.
23
+ *
24
+ * @beta
25
+ */
26
+ export declare class AppCredential implements TokenCredential {
27
+ private readonly msalClient;
28
+ /**
29
+ * Constructor of AppCredential.
30
+ *
31
+ * @remarks
32
+ * Only works in in server side.
33
+ *
34
+ * @param {AuthenticationConfiguration} authConfig - The authentication configuration. Use environment variables if not provided.
35
+ *
36
+ * @throws {@link ErrorCode|InvalidConfiguration} when client id, client secret or tenant id is not found in config.
37
+ * @throws {@link ErrorCode|RuntimeNotSupported} when runtime is nodeJS.
38
+ *
39
+ * @beta
40
+ */
41
+ constructor(authConfig: AuthenticationConfiguration);
42
+ /**
43
+ * Get access token for credential.
44
+ *
45
+ * @example
46
+ * ```typescript
47
+ * await credential.getToken(["User.Read.All"]) // Get Graph access token for single scope using string array
48
+ * await credential.getToken("User.Read.All") // Get Graph access token for single scope using string
49
+ * await credential.getToken(["User.Read.All", "Calendars.Read"]) // Get Graph access token for multiple scopes using string array
50
+ * await credential.getToken("User.Read.All Calendars.Read") // Get Graph access token for multiple scopes using space-separated string
51
+ * await credential.getToken("https://graph.microsoft.com/User.Read.All") // Get Graph access token with full resource URI
52
+ * await credential.getToken(["https://outlook.office.com/Mail.Read"]) // Get Outlook access token
53
+ * ```
54
+ *
55
+ * @param {string | string[]} scopes - The list of scopes for which the token will have access.
56
+ * @param {GetTokenOptions} options - The options used to configure any requests this TokenCredential implementation might make.
57
+ *
58
+ * @throws {@link ErrorCode|ServiceError} when get access token with authentication error.
59
+ * @throws {@link ErrorCode|InternalError} when get access token with unknown error.
60
+ * @throws {@link ErrorCode|InvalidParameter} when scopes is not a valid string or string array.
61
+ * @throws {@link ErrorCode|RuntimeNotSupported} when runtime is nodeJS.
62
+ *
63
+ * @returns Access token with expected scopes.
64
+ * Throw error if get access token failed.
65
+ *
66
+ * @beta
67
+ */
68
+ getToken(scopes: string | string[], options?: GetTokenOptions): Promise<AccessToken | null>;
69
+ /**
70
+ * Load and validate authentication configuration
71
+ *
72
+ * @param {AuthenticationConfiguration} authConfig - The authentication configuration. Use environment variables if not provided.
73
+ *
74
+ * @returns Authentication configuration
75
+ */
76
+ private loadAndValidateConfig;
77
+ }
78
+
12
79
  /**
13
80
  * Authentication related configuration.
14
81
  * @beta
@@ -44,12 +111,6 @@ export declare interface AuthenticationConfiguration {
44
111
  * @readonly
45
112
  */
46
113
  readonly certificateContent?: string;
47
- /**
48
- * Endpoint of auth service provisioned by Teams Framework. Default value comes from SIMPLE_AUTH_ENDPOINT environment variable.
49
- *
50
- * @readonly
51
- */
52
- readonly simpleAuthEndpoint?: string;
53
114
  /**
54
115
  * Login page for Teams to redirect to. Default value comes from INITIATE_LOGIN_ENDPOINT environment variable.
55
116
  *
@@ -62,25 +123,6 @@ export declare interface AuthenticationConfiguration {
62
123
  readonly applicationIdUri?: string;
63
124
  }
64
125
 
65
- /**
66
- * Configuration for current environment.
67
- * @beta
68
- */
69
- export declare interface Configuration {
70
- /**
71
- * Authentication related configuration.
72
- *
73
- * @readonly
74
- */
75
- readonly authentication?: AuthenticationConfiguration;
76
- /**
77
- * Configuration for resources.
78
- *
79
- * @readonly
80
- */
81
- readonly resources?: ResourceConfiguration[];
82
- }
83
-
84
126
  /**
85
127
  * Get Microsoft graph client.
86
128
  *
@@ -123,7 +165,7 @@ export declare interface Configuration {
123
165
  * }
124
166
  * ```
125
167
  *
126
- * @param {TokenCredential} credential - token credential instance.
168
+ * @param {TeamsFx} teamsfx - Used to provide configuration and auth.
127
169
  * @param scopes - The array of Microsoft Token scope of access. Default value is `[.default]`.
128
170
  *
129
171
  * @throws {@link ErrorCode|InvalidParameter} when scopes is not a valid string or string array.
@@ -132,71 +174,7 @@ export declare interface Configuration {
132
174
  *
133
175
  * @beta
134
176
  */
135
- export declare function createMicrosoftGraphClient(credential: TokenCredential, scopes?: string | string[]): Client;
136
-
137
- /**
138
- * SQL connection configuration instance.
139
- * @remarks
140
- * Only works in in server side.
141
- *
142
- * @beta
143
- *
144
- */
145
- export declare class DefaultTediousConnectionConfiguration {
146
- /**
147
- * MSSQL default scope
148
- * https://docs.microsoft.com/en-us/azure/app-service/app-service-web-tutorial-connect-msi
149
- */
150
- private readonly defaultSQLScope;
151
- /**
152
- * Generate connection configuration consumed by tedious.
153
- *
154
- * @param { string? } databaseName - specify database name to override default one if there are multiple databases.
155
- *
156
- * @returns Connection configuration of tedious for the SQL.
157
- *
158
- * @throws {@link ErrorCode|InvalidConfiguration} when SQL config resource configuration is invalid.
159
- * @throws {@link ErrorCode|InternalError} when get user MSI token failed or MSI token is invalid.
160
- * @throws {@link ErrorCode|RuntimeNotSupported} when runtime is browser.
161
- *
162
- * @beta
163
- */
164
- getConfig(databaseName?: string): Promise<ConnectionConfig>;
165
- /**
166
- * Check SQL use MSI identity or username and password.
167
- *
168
- * @returns false - login with SQL MSI identity, true - login with username and password.
169
- * @internal
170
- */
171
- private isMsiAuthentication;
172
- /**
173
- * check configuration is an available configurations.
174
- * @param { SqlConfiguration } sqlConfig
175
- *
176
- * @returns true - SQL configuration has a valid SQL endpoints, SQL username with password or identity ID.
177
- * false - configuration is not valid.
178
- * @internal
179
- */
180
- private isSQLConfigurationValid;
181
- /**
182
- * Generate tedious connection configuration with default authentication type.
183
- *
184
- * @param { SqlConfiguration } SQL configuration with username and password.
185
- *
186
- * @returns Tedious connection configuration with username and password.
187
- * @internal
188
- */
189
- private generateDefaultConfig;
190
- /**
191
- * Generate tedious connection configuration with azure-active-directory-access-token authentication type.
192
- *
193
- * @param { SqlConfiguration } SQL configuration with AAD access token.
194
- *
195
- * @returns Tedious connection configuration with access token.
196
- * @internal
197
- */
198
- private generateTokenConfig;
199
- }
177
+ export declare function createMicrosoftGraphClient(teamsfx: TeamsFxConfiguration, scopes?: string | string[]): Client;
200
178
 
201
179
  /**
202
180
  * Error code to trace the error types.
@@ -250,7 +228,11 @@ export declare enum ErrorCode {
250
228
  /**
251
229
  * Invalid response error.
252
230
  */
253
- InvalidResponse = "InvalidResponse"
231
+ InvalidResponse = "InvalidResponse",
232
+ /**
233
+ * Identity type error.
234
+ */
235
+ IdentityTypeNotSupported = "IdentityTypeNotSupported"
254
236
  }
255
237
 
256
238
  /**
@@ -276,17 +258,6 @@ export declare class ErrorWithCode extends Error {
276
258
  constructor(message?: string, code?: ErrorCode);
277
259
  }
278
260
 
279
- /**
280
- * Get configuration for authentication.
281
- *
282
- * @returns Authentication configuration from global configuration instance, the value may be undefined if no authentication config exists in current environment.
283
- *
284
- * @throws {@link ErrorCode|InvalidConfiguration} when global configuration does not exist
285
- *
286
- * @beta
287
- */
288
- export declare function getAuthenticationConfiguration(): AuthenticationConfiguration | undefined;
289
-
290
261
  /**
291
262
  * Get log level.
292
263
  *
@@ -297,30 +268,36 @@ export declare function getAuthenticationConfiguration(): AuthenticationConfigur
297
268
  export declare function getLogLevel(): LogLevel | undefined;
298
269
 
299
270
  /**
300
- * Get configuration for a specific resource.
301
- * @param {ResourceType} resourceType - The type of resource
302
- * @param {string} resourceName - The name of resource, default value is "default".
271
+ * Generate connection configuration consumed by tedious.
272
+ *
273
+ * @param {TeamsFx} teamsfx - Used to provide configuration and auth
274
+ * @param { string? } databaseName - specify database name to override default one if there are multiple databases.
303
275
  *
304
- * @returns Resource configuration for target resource from global configuration instance.
276
+ * @returns Connection configuration of tedious for the SQL.
305
277
  *
306
- * @throws {@link ErrorCode|InvalidConfiguration} when resource configuration with the specific type and name is not found
278
+ * @throws {@link ErrorCode|InvalidConfiguration} when SQL config resource configuration is invalid.
279
+ * @throws {@link ErrorCode|InternalError} when get user MSI token failed or MSI token is invalid.
280
+ * @throws {@link ErrorCode|RuntimeNotSupported} when runtime is browser.
307
281
  *
308
282
  * @beta
309
283
  */
310
- export declare function getResourceConfiguration(resourceType: ResourceType, resourceName?: string): {
311
- [index: string]: any;
312
- };
284
+ export declare function getTediousConnectionConfig(teamsfx: TeamsFx, databaseName?: string): Promise<ConnectionConfig>;
313
285
 
314
286
  /**
315
- * Initialize configuration from environment variables or configuration object and set the global instance
316
- *
317
- * @param {Configuration} configuration - Optional configuration that overrides the default configuration values. The override depth is 1.
318
- *
319
- * @throws {@link ErrorCode|InvalidParameter} when configuration is not passed in browser environment
287
+ * Identity type to use in authentication.
320
288
  *
321
289
  * @beta
322
290
  */
323
- export declare function loadConfiguration(configuration?: Configuration): void;
291
+ export declare enum IdentityType {
292
+ /**
293
+ * Represents the current user of Teams.
294
+ */
295
+ User = "User",
296
+ /**
297
+ * Represents the application itself.
298
+ */
299
+ App = "Application"
300
+ }
324
301
 
325
302
  /**
326
303
  * Log function for customized logging.
@@ -376,80 +353,18 @@ export declare enum LogLevel {
376
353
  Error = 3
377
354
  }
378
355
 
379
- /**
380
- * Represent Microsoft 365 tenant identity, and it is usually used when user is not involved like time-triggered automation job.
381
- *
382
- * @example
383
- * ```typescript
384
- * loadConfiguration(); // load configuration from environment variables
385
- * const credential = new M365TenantCredential();
386
- * ```
387
- *
388
- * @remarks
389
- * Only works in in server side.
390
- *
391
- * @beta
392
- */
393
- export declare class M365TenantCredential implements TokenCredential {
394
- private readonly msalClient;
395
- /**
396
- * Constructor of M365TenantCredential.
397
- *
398
- * @remarks
399
- * Only works in in server side.
400
- *
401
- * @throws {@link ErrorCode|InvalidConfiguration} when client id, client secret or tenant id is not found in config.
402
- * @throws {@link ErrorCode|RuntimeNotSupported} when runtime is nodeJS.
403
- *
404
- * @beta
405
- */
406
- constructor();
407
- /**
408
- * Get access token for credential.
409
- *
410
- * @example
411
- * ```typescript
412
- * await credential.getToken(["User.Read.All"]) // Get Graph access token for single scope using string array
413
- * await credential.getToken("User.Read.All") // Get Graph access token for single scope using string
414
- * await credential.getToken(["User.Read.All", "Calendars.Read"]) // Get Graph access token for multiple scopes using string array
415
- * await credential.getToken("User.Read.All Calendars.Read") // Get Graph access token for multiple scopes using space-separated string
416
- * await credential.getToken("https://graph.microsoft.com/User.Read.All") // Get Graph access token with full resource URI
417
- * await credential.getToken(["https://outlook.office.com/Mail.Read"]) // Get Outlook access token
418
- * ```
419
- *
420
- * @param {string | string[]} scopes - The list of scopes for which the token will have access.
421
- * @param {GetTokenOptions} options - The options used to configure any requests this TokenCredential implementation might make.
422
- *
423
- * @throws {@link ErrorCode|ServiceError} when get access token with authentication error.
424
- * @throws {@link ErrorCode|InternalError} when get access token with unknown error.
425
- * @throws {@link ErrorCode|InvalidParameter} when scopes is not a valid string or string array.
426
- * @throws {@link ErrorCode|RuntimeNotSupported} when runtime is nodeJS.
427
- *
428
- * @returns Access token with expected scopes.
429
- * Throw error if get access token failed.
430
- *
431
- * @beta
432
- */
433
- getToken(scopes: string | string[], options?: GetTokenOptions): Promise<AccessToken | null>;
434
- /**
435
- * Load and validate authentication configuration
436
- * @returns Authentication configuration
437
- */
438
- private loadAndValidateConfig;
439
- }
440
-
441
356
  /**
442
357
  * Microsoft Graph auth provider for Teams Framework
443
358
  *
444
359
  * @beta
445
360
  */
446
361
  export declare class MsGraphAuthProvider implements AuthenticationProvider {
447
- private credential;
362
+ private teamsfx;
448
363
  private scopes;
449
364
  /**
450
365
  * Constructor of MsGraphAuthProvider.
451
366
  *
452
- * @param {TokenCredential} credential - Credential used to invoke Microsoft Graph APIs.
367
+ * @param {TeamsFx} teamsfx - Used to provide configuration and auth.
453
368
  * @param {string | string[]} scopes - The list of scopes for which the token will have access.
454
369
  *
455
370
  * @throws {@link ErrorCode|InvalidParameter} when scopes is not a valid string or string array.
@@ -458,7 +373,7 @@ export declare class MsGraphAuthProvider implements AuthenticationProvider {
458
373
  *
459
374
  * @beta
460
375
  */
461
- constructor(credential: TokenCredential, scopes?: string | string[]);
376
+ constructor(teamsfx: TeamsFxConfiguration, scopes?: string | string[]);
462
377
  /**
463
378
  * Get access token for Microsoft Graph API requests.
464
379
  *
@@ -479,7 +394,6 @@ export declare class MsGraphAuthProvider implements AuthenticationProvider {
479
394
  *
480
395
  * @example
481
396
  * ```typescript
482
- * loadConfiguration(); // load configuration from environment variables
483
397
  * const credential = new OnBehalfOfUserCredential(ssoToken);
484
398
  * ```
485
399
  *
@@ -498,6 +412,7 @@ export declare class OnBehalfOfUserCredential implements TokenCredential {
498
412
  * Only works in in server side.
499
413
  *
500
414
  * @param {string} ssoToken - User token provided by Teams SSO feature.
415
+ * @param {AuthenticationConfiguration} config - The authentication configuration. Use environment variables if not provided.
501
416
  *
502
417
  * @throws {@link ErrorCode|InvalidConfiguration} when client id, client secret, certificate content, authority host or tenant id is not found in config.
503
418
  * @throws {@link ErrorCode|InternalError} when SSO token is not valid.
@@ -505,7 +420,7 @@ export declare class OnBehalfOfUserCredential implements TokenCredential {
505
420
  *
506
421
  * @beta
507
422
  */
508
- constructor(ssoToken: string);
423
+ constructor(ssoToken: string, config: AuthenticationConfiguration);
509
424
  /**
510
425
  * Get access token from credential.
511
426
  *
@@ -561,50 +476,6 @@ export declare class OnBehalfOfUserCredential implements TokenCredential {
561
476
  private generateAuthServerError;
562
477
  }
563
478
 
564
- /**
565
- * Configuration for resources.
566
- * @beta
567
- */
568
- export declare interface ResourceConfiguration {
569
- /**
570
- * Resource type.
571
- *
572
- * @readonly
573
- */
574
- readonly type: ResourceType;
575
- /**
576
- * Resource name.
577
- *
578
- * @readonly
579
- */
580
- readonly name: string;
581
- /**
582
- * Config for the resource.
583
- *
584
- * @readonly
585
- */
586
- readonly properties: {
587
- [index: string]: any;
588
- };
589
- }
590
-
591
- /**
592
- * Available resource type.
593
- * @beta
594
- */
595
- export declare enum ResourceType {
596
- /**
597
- * SQL database.
598
- *
599
- */
600
- SQL = 0,
601
- /**
602
- * Rest API.
603
- *
604
- */
605
- API = 1
606
- }
607
-
608
479
  /**
609
480
  * Set custom log function. Use the function if it's set. Priority is lower than setLogger.
610
481
  *
@@ -677,7 +548,6 @@ export declare function setLogLevel(level: LogLevel): void;
677
548
  * const dialogState = convoState.createProperty('dialogState');
678
549
  * const dialogs = new DialogSet(dialogState);
679
550
  *
680
- * loadConfiguration();
681
551
  * dialogs.add(new TeamsBotSsoPrompt('TeamsBotSsoPrompt', {
682
552
  * scopes: ["User.Read"],
683
553
  * }));
@@ -703,10 +573,12 @@ export declare function setLogLevel(level: LogLevel): void;
703
573
  * @beta
704
574
  */
705
575
  export declare class TeamsBotSsoPrompt extends Dialog {
576
+ private teamsfx;
706
577
  private settings;
707
578
  /**
708
579
  * Constructor of TeamsBotSsoPrompt.
709
580
  *
581
+ * @param {TeamsFx} teamsfx - Used to provide configuration and auth
710
582
  * @param dialogId Unique ID of the dialog within its parent `DialogSet` or `ComponentDialog`.
711
583
  * @param settings Settings used to configure the prompt.
712
584
  *
@@ -715,7 +587,7 @@ export declare class TeamsBotSsoPrompt extends Dialog {
715
587
  *
716
588
  * @beta
717
589
  */
718
- constructor(dialogId: string, settings: TeamsBotSsoPromptSettings);
590
+ constructor(teamsfx: TeamsFx, dialogId: string, settings: TeamsBotSsoPromptSettings);
719
591
  /**
720
592
  * Called when a prompt dialog is pushed onto the dialog stack and is being activated.
721
593
  * @remarks
@@ -752,6 +624,7 @@ export declare class TeamsBotSsoPrompt extends Dialog {
752
624
  * @beta
753
625
  */
754
626
  continueDialog(dc: DialogContext): Promise<DialogTurnResult>;
627
+ private loadAndValidateConfig;
755
628
  /**
756
629
  * Ensure bot is running in MS Teams since TeamsBotSsoPrompt is only supported in MS Teams channel.
757
630
  * @param dc dialog context
@@ -836,6 +709,187 @@ export declare interface TeamsBotSsoPromptTokenResponse extends TokenResponse {
836
709
  ssoTokenExpiration: string;
837
710
  }
838
711
 
712
+ /**
713
+ * A class providing credential and configuration.
714
+ * @beta
715
+ */
716
+ export declare class TeamsFx implements TeamsFxConfiguration {
717
+ private configuration;
718
+ private oboUserCredential?;
719
+ private appCredential?;
720
+ private identityType;
721
+ /**
722
+ * Constructor of TeamsFx
723
+ *
724
+ * @param {IdentityType} identityType - Choose user or app identity
725
+ * @param customConfig - key/value pairs of customized configuration that overrides default ones.
726
+ *
727
+ * @throws {@link ErrorCode|IdentityTypeNotSupported} when setting app identity in browser.
728
+ *
729
+ * @beta
730
+ */
731
+ constructor(identityType?: IdentityType, customConfig?: Record<string, string>);
732
+ /**
733
+ * Identity type set by user.
734
+ *
735
+ * @returns identity type.
736
+ * @beta
737
+ */
738
+ getIdentityType(): IdentityType;
739
+ /**
740
+ * Credential instance according to identity type choice.
741
+ *
742
+ * @remarks If user identity is chose, will return {@link TeamsUserCredential}
743
+ * in browser environment and {@link OnBehalfOfUserCredential} in NodeJS. If app
744
+ * identity is chose, will return {@link AppCredential}.
745
+ *
746
+ * @returns instance implements TokenCredential interface.
747
+ * @beta
748
+ */
749
+ getCredential(): TokenCredential;
750
+ /**
751
+ * Get user information.
752
+ * @returns UserInfo object.
753
+ * @beta
754
+ */
755
+ getUserInfo(): Promise<UserInfo>;
756
+ /**
757
+ * Popup login page to get user's access token with specific scopes.
758
+ *
759
+ * @remarks
760
+ * Only works in Teams client APP. User will be redirected to the authorization page to login and consent.
761
+ *
762
+ * @example
763
+ * ```typescript
764
+ * await teamsfx.login(["https://graph.microsoft.com/User.Read"]); // single scope using string array
765
+ * await teamsfx.login("https://graph.microsoft.com/User.Read"); // single scopes using string
766
+ * await teamsfx.login(["https://graph.microsoft.com/User.Read", "Calendars.Read"]); // multiple scopes using string array
767
+ * await teamsfx.login("https://graph.microsoft.com/User.Read Calendars.Read"); // multiple scopes using string
768
+ * ```
769
+ * @param scopes - The list of scopes for which the token will have access, before that, we will request user to consent.
770
+ *
771
+ * @throws {@link ErrorCode|InternalError} when failed to login with unknown error.
772
+ * @throws {@link ErrorCode|ConsentFailed} when user canceled or failed to consent.
773
+ * @throws {@link ErrorCode|InvalidParameter} when scopes is not a valid string or string array.
774
+ * @throws {@link ErrorCode|RuntimeNotSupported} when runtime is nodeJS.
775
+ *
776
+ * @beta
777
+ */
778
+ login(scopes: string | string[]): Promise<void>;
779
+ /**
780
+ * Set SSO token when using user identity in NodeJS.
781
+ * @param {string} ssoToken - used for on behalf of user flow.
782
+ * @returns self instance.
783
+ * @beta
784
+ */
785
+ setSsoToken(ssoToken: string): TeamsFx;
786
+ /**
787
+ * Usually used by service plugins to retrieve specific config
788
+ * @param {string} key - configuration key.
789
+ * @returns value in configuration.
790
+ * @beta
791
+ */
792
+ getConfig(key: string): string;
793
+ /**
794
+ * Check the value of specific key.
795
+ * @param {string} key - configuration key.
796
+ * @returns true if corresponding value is not empty string.
797
+ * @beta
798
+ */
799
+ hasConfig(key: string): boolean;
800
+ /**
801
+ * Get all configurations.
802
+ * @returns key value mappings.
803
+ * @beta
804
+ */
805
+ getConfigs(): Record<string, string>;
806
+ /**
807
+ * Load configuration from environment variables.
808
+ */
809
+ private loadFromEnv;
810
+ }
811
+
812
+ /**
813
+ * TeamsFx interface that provides credential and configuration.
814
+ * @beta
815
+ */
816
+ declare interface TeamsFxConfiguration {
817
+ /**
818
+ * Identity type set by user.
819
+ *
820
+ * @returns identity type.
821
+ * @beta
822
+ */
823
+ getIdentityType(): IdentityType;
824
+ /**
825
+ * Credential instance according to identity type choice.
826
+ *
827
+ * @remarks If user identity is chose, will return {@link TeamsUserCredential}
828
+ * in browser environment and {@link OnBehalfOfUserCredential} in NodeJS. If app
829
+ * identity is chose, will return {@link AppCredential}.
830
+ *
831
+ * @returns instance implements TokenCredential interface.
832
+ * @beta
833
+ */
834
+ getCredential(): TokenCredential;
835
+ /**
836
+ * Get user information.
837
+ * @returns UserInfo object.
838
+ * @beta
839
+ */
840
+ getUserInfo(): Promise<UserInfo>;
841
+ /**
842
+ * Popup login page to get user's access token with specific scopes.
843
+ *
844
+ * @remarks
845
+ * Only works in Teams client APP. User will be redirected to the authorization page to login and consent.
846
+ *
847
+ * @example
848
+ * ```typescript
849
+ * await teamsfx.login(["https://graph.microsoft.com/User.Read"]); // single scope using string array
850
+ * await teamsfx.login("https://graph.microsoft.com/User.Read"); // single scopes using string
851
+ * await teamsfx.login(["https://graph.microsoft.com/User.Read", "Calendars.Read"]); // multiple scopes using string array
852
+ * await teamsfx.login("https://graph.microsoft.com/User.Read Calendars.Read"); // multiple scopes using string
853
+ * ```
854
+ * @param scopes - The list of scopes for which the token will have access, before that, we will request user to consent.
855
+ *
856
+ * @throws {@link ErrorCode|InternalError} when failed to login with unknown error.
857
+ * @throws {@link ErrorCode|ConsentFailed} when user canceled or failed to consent.
858
+ * @throws {@link ErrorCode|InvalidParameter} when scopes is not a valid string or string array.
859
+ * @throws {@link ErrorCode|RuntimeNotSupported} when runtime is nodeJS.
860
+ *
861
+ * @beta
862
+ */
863
+ login(scopes: string | string[]): Promise<void>;
864
+ /**
865
+ * Set SSO token when using user identity in NodeJS.
866
+ * @param {string} ssoToken - used for on behalf of user flow.
867
+ * @returns self instance.
868
+ * @beta
869
+ */
870
+ setSsoToken(ssoToken: string): TeamsFxConfiguration;
871
+ /**
872
+ * Usually used by service plugins to retrieve specific config
873
+ * @param {string} key - configuration key.
874
+ * @returns value in configuration.
875
+ * @beta
876
+ */
877
+ getConfig(key: string): string;
878
+ /**
879
+ * Check the value of specific key.
880
+ * @param {string} key - configuration key.
881
+ * @returns true if corresponding value is not empty string.
882
+ * @beta
883
+ */
884
+ hasConfig(key: string): boolean;
885
+ /**
886
+ * Get all configurations.
887
+ * @returns key value mappings.
888
+ * @beta
889
+ */
890
+ getConfigs(): Record<string, string>;
891
+ }
892
+
839
893
  /**
840
894
  * Represent Teams current user's identity, and it is used within Teams client applications.
841
895
  *
@@ -851,7 +905,7 @@ export declare class TeamsUserCredential implements TokenCredential {
851
905
  * Can only be used within Teams.
852
906
  * @beta
853
907
  */
854
- constructor();
908
+ constructor(authConfig: AuthenticationConfiguration);
855
909
  /**
856
910
  * Popup login page to get user's access token with specific scopes.
857
911
  * @remarks