From cfa6c3349acdf54c5c9af7acbef85f762c53bc46 Mon Sep 17 00:00:00 2001 From: "Laurence B. Ininda" Date: Mon, 29 Aug 2022 10:41:55 -0500 Subject: [PATCH 1/2] docs: add missing import --- docs/TokenCredentialAuthenticationProvider.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/TokenCredentialAuthenticationProvider.md b/docs/TokenCredentialAuthenticationProvider.md index 43de78aa1..f48394460 100644 --- a/docs/TokenCredentialAuthenticationProvider.md +++ b/docs/TokenCredentialAuthenticationProvider.md @@ -16,6 +16,7 @@ // Import the TokenCredential class that you wish to use. This example uses a Client SecretCredential import { ClientSecretCredential } from "@azure/identity"; +import { Client } from "@microsoft/microsoft-graph-client"; import { TokenCredentialAuthenticationProvider, TokenCredentialAuthenticationProviderOptions } from "@microsoft/microsoft-graph-client/authProviders/azureTokenCredentials"; // Create an instance of the TokenCredential class that is imported From d965bb7b7aaad215ee2bb13372c8b51f6c28d305 Mon Sep 17 00:00:00 2001 From: laudebugs Date: Mon, 29 Aug 2022 12:04:38 -0400 Subject: [PATCH 2/2] refactor: GetTokenOptions type --- .../ITokenCredentialAuthenticationProviderOptions.ts | 4 ++-- .../TokenCredentialAuthenticationProvider.ts | 2 +- .../authentication/TokenCredentialAuthenticationProvider.ts | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/authentication/azureTokenCredentials/ITokenCredentialAuthenticationProviderOptions.ts b/src/authentication/azureTokenCredentials/ITokenCredentialAuthenticationProviderOptions.ts index 09b3b0995..c07ffb1bd 100644 --- a/src/authentication/azureTokenCredentials/ITokenCredentialAuthenticationProviderOptions.ts +++ b/src/authentication/azureTokenCredentials/ITokenCredentialAuthenticationProviderOptions.ts @@ -11,8 +11,8 @@ import { AuthenticationProviderOptions } from "../../IAuthenticationProviderOpti /** * @interface * A signature represents the Authentication provider options for Token Credentials - * @property {getTokenoptions} [GetTokenOptions] - Defines options for TokenCredential.getToken. + * @property {getTokenOptions} [GetTokenOptions] - Defines options for TokenCredential.getToken. */ export interface TokenCredentialAuthenticationProviderOptions extends AuthenticationProviderOptions { - getTokenoptions?: GetTokenOptions; + getTokenOptions?: GetTokenOptions; } diff --git a/src/authentication/azureTokenCredentials/TokenCredentialAuthenticationProvider.ts b/src/authentication/azureTokenCredentials/TokenCredentialAuthenticationProvider.ts index 7d9d1faab..9e4b63bf5 100644 --- a/src/authentication/azureTokenCredentials/TokenCredentialAuthenticationProvider.ts +++ b/src/authentication/azureTokenCredentials/TokenCredentialAuthenticationProvider.ts @@ -70,7 +70,7 @@ export class TokenCredentialAuthenticationProvider implements AuthenticationProv error.message = "Scopes cannot be empty, Please provide scopes"; throw error; } - const response = await this.tokenCredential.getToken(scopes, this.authenticationProviderOptions.getTokenoptions); + const response = await this.tokenCredential.getToken(scopes, this.authenticationProviderOptions.getTokenOptions); if (response) { return response.token; } diff --git a/test/node/authentication/TokenCredentialAuthenticationProvider.ts b/test/node/authentication/TokenCredentialAuthenticationProvider.ts index 4a1183d15..31fff68cd 100644 --- a/test/node/authentication/TokenCredentialAuthenticationProvider.ts +++ b/test/node/authentication/TokenCredentialAuthenticationProvider.ts @@ -23,7 +23,7 @@ describe("TokenCredentialAuthenticationProvider.ts", () => { } const authProviderOptions: TokenCredentialAuthenticationProviderOptions = { - getTokenoptions: null, + getTokenOptions: null, scopes, }; const accessToken: AccessToken = { token: "dummy_valid_token", expiresOnTimestamp: 1 }; @@ -43,7 +43,7 @@ describe("TokenCredentialAuthenticationProvider.ts", () => { throw new Error("Method definition for getToken is not found"); } const authProviderOptions: TokenCredentialAuthenticationProviderOptions = { - getTokenoptions: null, + getTokenOptions: null, scopes, }; const accessToken: AccessToken = undefined;