TeamsSSOTokenExchangeMiddleware Class

If the activity name is signin/tokenExchange, self middleware will attempt to exchange the token, and deduplicate the incoming call, ensuring only one exchange request is processed.

Initializes a instance of the class.

sign on token exchange.

Inheritance
TeamsSSOTokenExchangeMiddleware

Constructor

TeamsSSOTokenExchangeMiddleware(storage: Storage, connection_name: str)

Parameters

Name Description
storage
Required

The Storage to use for deduplication.

connection_name
Required

The connection name to use for the single

Remarks

If a user is signed into multiple Teams clients, the Bot could receive a "signin/tokenExchange" from each client. Each token exchange request for a specific user login will have an identical Activity.Value.Id.

Only one of these token exchange requests should be processed by the bot. The others return . For a distributed bot in production, self requires a distributed storage ensuring only one token exchange is processed. self middleware supports CosmosDb storage found in Microsoft.Bot.Builder.Azure, or MemoryStorage for local development. IStorage's ETag implementation for token exchange activity deduplication.

Methods

on_turn

on_turn

async on_turn(context: TurnContext, logic: Callable[[TurnContext], Awaitable])

Parameters

Name Description
context
Required
logic
Required