'How to silently authenticate a multi-tenant Teams bot on behalf of a user?

How can I authenticate a multi-tenant bot silently on behalf of a user? I'm trying to replicate the behavior of the Microsoft Flow bot in Teams. This bot does not prompt the user to authenticate with an Oauth2 card, and it seamlessly retrieves my flows. How can I get the token of the current session from Teams to use it, for example, in a call to the Graph API? MS Bot Flow



Solution 1:[1]

Update : SSO is now supported for Tabs, Bots and Messaging Extension. Please take a look at following documentation:

Single sign-on (SSO) support for tabs

Single sign-on (SSO) support for bots

Single sign-on (SSO) support for messaging extensions

Solution 2:[2]

OAuth prompt can be used to sign in the user. As of now , the user needs to sign in only once,then when the token expires , the user will be authenticated silently.

https://docs.microsoft.com/en-us/azure/bot-service/bot-builder-authentication?view=azure-bot-service-4.0&tabs=aadv1%2Ccsharp%2Cbot-oauth

Please check out this sample: https://github.com/microsoft/BotBuilder-Samples/tree/master/samples/csharp_dotnetcore/18.bot-authentication

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1
Solution 2 Geethu Suresh