BotTokenProvider Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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 sealed class BotTokenProvider
type BotTokenProvider = class
Public NotInheritable Class BotTokenProvider
- Inheritance
-
BotTokenProvider
Constructors
| Name | Description |
|---|---|
| BotTokenProvider(IAuthorizationHeaderProvider, String, IOptionsMonitor<ManagedIdentityOptions>) |
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. |
Methods
| Name | Description |
|---|---|
| GetAgenticUserTokenAsync(AgenticIdentity, String, CancellationToken) |
Acquire a user-delegated token for an Agentic User, through the federated identity exchange. Reads as the agent rather than as the app, so it sees what was shared with the agent rather than everything the app may read. |
| GetAppTokenAsync(String, String, CancellationToken) |
Acquire an app-only token for the given scope. |