Sprog

UserAuthorization.GetTurnTokenAsTokenCredential(ITurnContext, String) Method

Definition

Creates a token credential backed by the user token for the current turn.

public Azure.Core.TokenCredential GetTurnTokenAsTokenCredential(Microsoft.Agents.Builder.ITurnContext turnContext, string handlerName = default);
member this.GetTurnTokenAsTokenCredential : Microsoft.Agents.Builder.ITurnContext * string -> Azure.Core.TokenCredential
Public Function GetTurnTokenAsTokenCredential (turnContext As ITurnContext, Optional handlerName As String = Nothing) As TokenCredential

Parameters

turnContext
ITurnContext

The current turn context.

handlerName
String

The user authorization handler name, or null to use the default handler.

Returns

A token credential that returns the current turn's user token.

Remarks

The returned credential is scoped to turnContext and must only be used during that turn. Do not cache it or provide it to a client that outlives the turn. Create a new credential in each turn instead.

Applies to