UsernamePasswordClient class

警告

此 API 現已淘汰。

  • Use a more secure flow instead

Oauth2.0 密碼授權客戶端注意:我們僅支援公開客戶端用於密碼授權及純粹測試目的

Extends
@azure/msal-common.BaseClient

繼承的屬性

authority
logger

方法

acquireToken(CommonUsernamePasswordRequest)

API 透過將使用者名稱和密碼傳遞給服務,取得憑證password_grant

繼承的方法

createTokenQueryParameters(BaseAuthRequest)

為 /token 請求建立查詢字串

sendPostRequest<T>(RequestThumbprint, string, NetworkRequestOptions, string)

封裝 sendPostRequestAsync 並包含必要的檢查前檢查與飛行後邏輯

updateAuthority(string, string)

更新用戶端的權威物件。 端點發現必須完成。

建構函式詳細資料

UsernamePasswordClient(ClientConfiguration)

new UsernamePasswordClient(configuration: ClientConfiguration)

參數

configuration
@azure/msal-common.ClientConfiguration

繼承的屬性詳細資料

authority

authority: Authority

屬性值

@azure/msal-common.Authority

繼承自 BaseClient.authority

logger

logger: Logger

屬性值

繼承自 BaseClient.logger

方法詳細資料

acquireToken(CommonUsernamePasswordRequest)

API 透過將使用者名稱和密碼傳遞給服務,取得憑證password_grant

function acquireToken(request: CommonUsernamePasswordRequest): Promise<null | AuthenticationResult>

參數

request
CommonUsernamePasswordRequest

CommonUsernamePasswordRequest

傳回

Promise<null | AuthenticationResult>

繼承的方法的詳細資料

createTokenQueryParameters(BaseAuthRequest)

為 /token 請求建立查詢字串

function createTokenQueryParameters(request: BaseAuthRequest): string

參數

request
BaseAuthRequest

傳回

string

繼承自 BaseClient.createTokenQueryParameters

sendPostRequest<T>(RequestThumbprint, string, NetworkRequestOptions, string)

封裝 sendPostRequestAsync 並包含必要的檢查前檢查與飛行後邏輯

function sendPostRequest<T>(thumbprint: RequestThumbprint, tokenEndpoint: string, options: NetworkRequestOptions, correlationId: string): Promise<NetworkResponse<T>>

參數

thumbprint
RequestThumbprint

請求指紋以進行限速

tokenEndpoint

string

Endpoint to POST to

options
NetworkRequestOptions

POST 請求中需包含的正文與標頭

correlationId

string

遙測的 CorreId

傳回

Promise<NetworkResponse<T>>

繼承自 BaseClient.sendPostRequest

updateAuthority(string, string)

更新用戶端的權威物件。 端點發現必須完成。

function updateAuthority(cloudInstanceHostname: string, correlationId: string): Promise<void>

參數

cloudInstanceHostname

string

correlationId

string

傳回

Promise<void>

繼承自 BaseClient.updateAuthority