Forum Discussion
Help implementing authentication for MS Teams Bot
My team is planning on building an MS Teams Bot (nodeJS) that would be used to send and schedule notifications to users within a company (Multi-Tenant).
Were planning on implementing the following workflow:
1. have an admin user within an external company install/authorize our app into their MS Teams instance
2. obtain a tokens from the step above that our app would be able to persist
3a. admin user would schedule a notification for a future date
4a. once future date arrives, bot is able retrieve persisted tokens (perhaps use refresh token to obtain new) and then send message to specific users
3b. admin user wants to push a notification to specific users
4b. bot is able retrieve persisted tokens (perhaps use refresh token to obtain new) and then send message to specific users
Slack offers a flow where a "bot token" is obtained rather than a user token which can then be leveraged to send notifications at a later point.
For some reference, something like this is similar to what we want: https://stackoverflow.com/a/47509000/5431797
Can you point me towards the right direction for making something like this work in MS Teams ?
- Sayali-MSFTMicrosoftbcabrera - Thanks for reporting your issue.
We will check this at our end and will get back to you. - Sayali-MSFTMicrosoftbcabrera- To implement the authentication, you can use the Azure Bot Service v4 SDK authentication, based on OAuth 2.0. This makes it easier to develop a bot that can use authentication tokens based on the user's credentials.
OAuth 2.0 is an open standard for authentication and authorization used by Microsoft Azure Active Directory (Azure AD) and many other identity providers. A basic understanding of OAuth 2.0 is a prerequisite for working with authentication in Teams.
Reference Document- https://learn.microsoft.com/en-us/microsoftteams/platform/bots/how-to/authentication/add-authentication?tabs=dotnet%2Cdotnet-sample
Sample Link- https://github.com/OfficeDev/Microsoft-Teams-Samples/tree/main/samples/bot-conversation-sso-quickstart/js