次の方法で共有


ClientSecretCredential class

App Registration用に生成されたクライアントシークレットを使ってMicrosoft Entra IDへの認証を可能にします。 クライアント シークレットを構成する方法の詳細については、以下を参照してください。

https://learn.microsoft.com/entra/identity-platform/quickstart-configure-app-access-web-apis#add-credentials-to-your-web-application

コンストラクター

ClientSecretCredential(string, string, string, ClientSecretCredentialOptions)

クライアントシークレットでMicrosoft Entra IDに対して認証するために必要な詳細を含むClientSecretCredentialのインスタンスを作成します。

メソッド

getToken(string | string[], GetTokenOptions)

Microsoft Entra IDで認証し、成功するとアクセストークンを返します。 認証に失敗すると、CredentialUnavailableError がスローされ、エラーの詳細が表示されます。

コンストラクターの詳細

ClientSecretCredential(string, string, string, ClientSecretCredentialOptions)

クライアントシークレットでMicrosoft Entra IDに対して認証するために必要な詳細を含むClientSecretCredentialのインスタンスを作成します。

new ClientSecretCredential(tenantId: string, clientId: string, clientSecret: string, options?: ClientSecretCredentialOptions)

パラメーター

tenantId

string

Microsoft Entra テナント(ディレクトリ)ID。

clientId

string

テナント内のアプリ登録のクライアント (アプリケーション) ID。

clientSecret

string

アプリ登録用に生成されたクライアント シークレット。

options
ClientSecretCredentialOptions

認証要求を行うクライアントを構成するためのオプション。

メソッドの詳細

getToken(string | string[], GetTokenOptions)

Microsoft Entra IDで認証し、成功するとアクセストークンを返します。 認証に失敗すると、CredentialUnavailableError がスローされ、エラーの詳細が表示されます。

function getToken(scopes: string | string[], options?: GetTokenOptions): Promise<AccessToken>

パラメーター

scopes

string | string[]

トークンがアクセスできるスコープの一覧。

options
GetTokenOptions

この TokenCredential 実装が行う可能性がある要求を構成するために使用されるオプション。

返品

Promise<AccessToken>