Language

BotTokenProvider Constructor

Definition

Acquires access tokens for the bot's own identity, or for an Agentic User the bot is acting as, backed by the same Microsoft.Identity.Web provider and named MSAL options the outbound HTTP pipeline uses.

The same acquisition Microsoft.Teams.Core.Hosting.BotAuthenticationHandler performs on every outbound Bot Framework call, reachable by a caller that is not an HTTP pipeline. The scope is a parameter rather than a constant: the underlying Microsoft.Identity.Web call is resource-agnostic, and the only thing that varies per resource is which scope is asked for.

A concrete class rather than an interface, deliberately. This SDK's public surface is concrete types; the only two public interfaces it has are extension points a consumer implements, and this is not one. Nothing outside the SDK supplies token acquisition, and anyone who wants to control it can inject the already-public IAuthorizationHeaderProvider this is built from. Shipping a class rather than an interface also leaves the shape free to change without breaking an implementor.

public BotTokenProvider(Microsoft.Identity.Abstractions.IAuthorizationHeaderProvider authorizationHeaderProvider, string? authenticationOptionsName = default, Microsoft.Extensions.Options.IOptionsMonitor<Microsoft.Identity.Abstractions.ManagedIdentityOptions>? managedIdentityOptions = default);
new Microsoft.Teams.Core.Hosting.BotTokenProvider : Microsoft.Identity.Abstractions.IAuthorizationHeaderProvider * string * Microsoft.Extensions.Options.IOptionsMonitor<Microsoft.Identity.Abstractions.ManagedIdentityOptions> -> Microsoft.Teams.Core.Hosting.BotTokenProvider
Public Sub New (authorizationHeaderProvider As IAuthorizationHeaderProvider, Optional authenticationOptionsName As String = Nothing, Optional managedIdentityOptions As IOptionsMonitor(Of ManagedIdentityOptions) = Nothing)

Parameters

authorizationHeaderProvider
IAuthorizationHeaderProvider

The authorization header provider for acquiring tokens.

authenticationOptionsName
String

The name of the MSAL configuration options to use for token acquisition. Defaults to "AzureAd".

managedIdentityOptions
IOptionsMonitor<ManagedIdentityOptions>

Optional managed identity options monitor, applied on the same terms as the outbound pipeline applies it.

Applies to