Sprog

IAgenticTokenProvider.GetAgenticUserTokenAsync Method

Definition

Acquires an agentic user token that represents the agent acting on behalf of a specific agentic user for the requested scopes.

public System.Threading.Tasks.Task<string> GetAgenticUserTokenAsync(string tenantId, string agentAppInstanceId, string upn, System.Collections.Generic.IList<string> scopes, System.Threading.CancellationToken cancellationToken = default);
abstract member GetAgenticUserTokenAsync : string * string * string * System.Collections.Generic.IList<string> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<string>
Public Function GetAgenticUserTokenAsync (tenantId As String, agentAppInstanceId As String, upn As String, scopes As IList(Of String), Optional cancellationToken As CancellationToken = Nothing) As Task(Of String)

Parameters

tenantId
String

The Entra tenant id the agent identity and user belong to.

agentAppInstanceId
String

The agent application instance id (the client id of the agent identity).

upn
String

The agentic user to act on behalf of. This may be the user's UPN (user principal name) or the user's object id (a GUID); implementations select the appropriate identifier based on the value.

scopes
IList<String>

The scopes to request for the resource the user token targets. When null or empty, the provider falls back to its configured default scope.

cancellationToken
CancellationToken

A token to cancel the asynchronous operation.

Returns

A task that resolves to the access token for the agentic user.

Remarks

The provider performs the full application → instance → agentic-user chain internally.

Applies to