UsernamePasswordClient class

警告

现已弃用此 API。

  • Use a more secure flow instead

Oauth2.0 密码授予客户端说明:我们仅支持公共客户端进行密码授予,仅用于纯测试目的

扩展
@azure/msal-common.BaseClient

继承属性

authority
logger

方法

acquireToken(CommonUsernamePasswordRequest)

将用户名和密码传递到凭据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)

将用户名和密码传递到凭据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

将 POST 设置为的终结点

options
NetworkRequestOptions

要包含在 POST 请求中的正文和标头

correlationId

string

遥测的 CorrelationId

返回

Promise<NetworkResponse<T>>

继承自 BaseClient.sendPostRequest

updateAuthority(string, string)

更新客户端的颁发机构对象。 终结点发现必须完成。

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

参数

cloudInstanceHostname

string

correlationId

string

返回

Promise<void>

继承自 BaseClient.updateAuthority