共用方式為


ClientCertificateCredential class

使用指派給應用程式註冊的 PEM 編碼憑證,啟用驗證以Microsoft Entra ID。 如需如何設定憑證驗證的詳細資訊,請參閱這裡:

https://learn.microsoft.com/en-us/azure/active-directory/develop/active-directory-certificate-credentials#register-your-certificate-with-azure-ad

建構函式

ClientCertificateCredential(string, string, ClientCertificatePEMCertificate, ClientCertificateCredentialOptions)

建立 ClientCertificateCredential 的實例,其中包含使用憑證對 Microsoft Entra ID 進行驗證所需的詳細數據。

ClientCertificateCredential(string, string, ClientCertificatePEMCertificatePath, ClientCertificateCredentialOptions)

建立 ClientCertificateCredential 的實例,其中包含使用憑證對 Microsoft Entra ID 進行驗證所需的詳細數據。

ClientCertificateCredential(string, string, string, ClientCertificateCredentialOptions)

建立 ClientCertificateCredential 的實例,其中包含使用憑證對 Microsoft Entra ID 進行驗證所需的詳細數據。

方法

getToken(string | string[], GetTokenOptions)

使用 Microsoft Entra 識別碼進行驗證,並在成功時傳回存取令牌。 如果驗證失敗,CredentialUnavailableError 將會擲回失敗的詳細數據。

建構函式詳細資料

ClientCertificateCredential(string, string, ClientCertificatePEMCertificate, ClientCertificateCredentialOptions)

建立 ClientCertificateCredential 的實例,其中包含使用憑證對 Microsoft Entra ID 進行驗證所需的詳細數據。

new ClientCertificateCredential(tenantId: string, clientId: string, configuration: ClientCertificatePEMCertificate, options?: ClientCertificateCredentialOptions)

參數

tenantId

string

Microsoft Entra 租使用者 (目錄) 識別符。

clientId

string

租用戶中應用程式註冊的用戶端(應用程式)標識碼。

configuration
ClientCertificatePEMCertificate

其他必要參數,包括 PEM 編碼的憑證作為字串。 如果忽略類型,我們將擲回 PEM 編碼憑證的值。

options
ClientCertificateCredentialOptions

設定發出驗證要求的客戶端的選項。

ClientCertificateCredential(string, string, ClientCertificatePEMCertificatePath, ClientCertificateCredentialOptions)

建立 ClientCertificateCredential 的實例,其中包含使用憑證對 Microsoft Entra ID 進行驗證所需的詳細數據。

new ClientCertificateCredential(tenantId: string, clientId: string, configuration: ClientCertificatePEMCertificatePath, options?: ClientCertificateCredentialOptions)

參數

tenantId

string

Microsoft Entra 租使用者 (目錄) 識別符。

clientId

string

租用戶中應用程式註冊的用戶端(應用程式)標識碼。

configuration
ClientCertificatePEMCertificatePath

其他必要參數,包括文件系統上憑證的路徑。 如果忽略類型,我們將擲回 PEM 憑證路徑的值。

options
ClientCertificateCredentialOptions

設定發出驗證要求的客戶端的選項。

ClientCertificateCredential(string, string, string, ClientCertificateCredentialOptions)

建立 ClientCertificateCredential 的實例,其中包含使用憑證對 Microsoft Entra ID 進行驗證所需的詳細數據。

new ClientCertificateCredential(tenantId: string, clientId: string, certificatePath: string, options?: ClientCertificateCredentialOptions)

參數

tenantId

string

Microsoft Entra 租使用者 (目錄) 識別符。

clientId

string

租用戶中應用程式註冊的用戶端(應用程式)標識碼。

certificatePath

string

檔系統上 PEM 編碼的公開/私鑰憑證路徑。

options
ClientCertificateCredentialOptions

設定發出驗證要求的客戶端的選項。

方法詳細資料

getToken(string | string[], GetTokenOptions)

使用 Microsoft Entra 識別碼進行驗證,並在成功時傳回存取令牌。 如果驗證失敗,CredentialUnavailableError 將會擲回失敗的詳細數據。

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

參數

scopes

string | string[]

令牌將具有存取權的範圍清單。

options
GetTokenOptions

用來設定此 TokenCredential 實作可能提出的任何要求的選項。

傳回

Promise<AccessToken>