-
Notifications
You must be signed in to change notification settings - Fork 528
Enable MS teams Channel #3792
Comments
This is functional but it takes a good bit of work. My company has it deployed in Teams and functional with the oAuth directions provided in the documents. This was taken from the Teams-Authbot project and modified to work with the template and what we found that is needed in the maindialog.cs is the following: Add the following steps into your waterfall, PromptStepAsync and LoginStepAsync, these need to be first and second AddDialog(new OAuthPrompt(nameof(OAuthPrompt), new OAuthPromptSettings Your Appsettings.json should have the following: "tokenExchangeConfig": { Yes I know the location does not seem correct per the docs but it works. For the two waterfallsteps added earlier, add the following functions: private async Task PromptStepAsync(WaterfallStepContext stepContext, CancellationToken cancellationToken)
You can modify the LoginStepAsync as needed for what it displays but this worked for our company. Now you need to add the Microsoft Graph class, SimpleGraphClient.cs, from the TeamsAuth bot located in the GitHub samples https://github.com/microsoft/BotBuilder-Samples/tree/main/samples/csharp_dotnetcore This should get your bot secured to your tenant and being able to prompt for authorization in Teams. Hope this helps. |
Thanks @SreekanthOAuth for reporting this issue. The next week we will start working on this issue but you can check the comment of @Kmeredith-hcg and check if it works for you. We will let you know as soon as we have any update 😊. |
@Kmeredith-hcg - Thank you so much for the information. We have also tried almost the same in typescript but it's not giving the tokens. |
Hi @SreekanthOAuth, we are analysing the issue, and we came up with some questions:
We will get back to you as soon as we have an update 🙂. |
Hi @VictorGrycuk, thanks for the response. Please find the answers to your questions,
Please let us know if you need further details on this. |
@VictorGrycuk - We are able to get the token now. the issue is - Since it's a MS teams channel, the history would be present. So, we had canceled all the dialogues and now we started getting the token from OAuthCardPrompt. And now we are trying for SSO, following the below URL to enable it but not getting any tokens. This time we are using AAD v2. Based on this section, we need to pass TokenExchangeResource property. But we don't find this in the Typescript sample. Could you please provide assistance on this. |
Hi @SreekanthOAuth, sorry for the delay. In regard to your question about We followed the guide to set up the JavaScript Teams Bot with SSO, and we were successful on enabling SSO in Teams and to see the token inside the We also recommend taking a look at the SSO with Simple Skill Consumer and Skill experimental sample. While it is written for C#, the implementation of the token exchange is quite similar as the one used in the previous sample. The SSO with Simple Skill Consumer and Skill sample implementation is quite similar to the suggestions made by @Kmeredith-hcg in a previous comment, so it would be worth to review that as well. Finally, we noticed that you have added your ngrok address in the webApplicationInfo in the manifest ( Documentation and samples we have used:
Let us know if this information has been useful to you. |
@VictorGrycuk , Thanks for the detailed information. We have followed the same but not getting the token.
Not sure what & where we are missing. And this is the SignIn dialog. This would be triggered when there is no user profile in the user state accessor from Maindialog.
Could you please check these and let us know what we are missing. And also, please answer below one
|
Hi @SreekanthOAuth, as agreed we are adding the summary of our call here. We identified 2 problems in the environment:
Our environment configuration and the modification implemented were based on the step-by-step guide found in the Bot Conversation SSO Quickstart sample. If you have further questions or comments, please let us know 🙂. |
Hi @SreekanthOAuth.
I hope you find these resources useful. Meanwhile, we will keep researching to give you an answer 🙂. |
@VictorGrycuk - We have gone through the above articles and most of them are related to the client-side. We have tried using the below API and able to get the token by using the AAD V1 but not with AAD V2. curl --location --request POST 'https://login.microsoftonline.com/[tenet]/oauth2/v2.0/token' With AAD V2 we are getting invalid grant type. Please let us know if you get any clues based on this. |
Hi @SreekanthOAuth. Currently, we couldn't obtain the id_token using the bot, also we researched in botbuilder-dotnet and botbuilder-js but we couldn't find any reference of id_token. Let's differenciate the concepts of
If you are trying to retrieve the information of the logged user using the If that's not the purpose, can you explain the reason to handle the id_token? Last but no least, we found a way to get id_token and the We collected the following links for you:
|
Hi @SreekanthOAuth, as discussed by email. We will close the issue as soon as you complete the testing on your Development environments. |
Hi @SreekanthOAuth, as discussed by email, we can close this issue 😊. |
What project is affected?
Virtual Assistant with botbuilder version 4.11.0
What language is this in?
Typescript
What happens?
We are enabling the MS teams channel for our bot (already enabled Directline channel which is up & running).
We have tried the below samples but those are not helpful.
https://github.com/OfficeDev/Microsoft-Teams-Samples/tree/main/samples/bot-conversation-sso-quickstart
https://github.com/OfficeDev/Microsoft-Teams-Samples/tree/main/samples/tab-sso/nodejs
We are configured OAuth setting as AAD with scopes are openid profile User.Read (also tried adding offline_access) at BOT service and when we try testing the connection we are able to get the token.
There is a membersAdded method in defaultActivityHandler.ts file, which is getting executed when clicking on the ADD button in App in teams but not seeing any token (authToken & idtoken) in turncontext.
We try logging from OAuthPrompt (from teams channel) but here also not getting the tokens.
What are the steps to reproduce this issue?
Create the virtual assistant by the following the URL,
https://microsoft.github.io/botframework-solutions/virtual-assistant/tutorials/create-assistant/typescript/3-create-project/
manifest.json file is
{ "$schema": "https://developer.microsoft.com/en-us/json-schemas/teams/v1.9/MicrosoftTeams.schema.json", "manifestVersion": "1.9", "version": "1.0.0", "showLoadingIndicator": true, "isFullScreen": true, "id": "aa186c9e-f7a1-4c43-b68e-22988a3f871b", "packageName": "com.microsoft.teams.eva-it-dev", "developer": { "name": "Ecolab", "websiteUrl": "https://www.xxxx.com", "privacyUrl": "https://www.xxxx.com/epp", "termsOfUseUrl": "https://www.xxxx.com/terms-of-use" }, "icons": { "color": "color.png", "outline": "outline.png" }, "name": { "short": "DEV-TEST", "full": "TEST" }, "description": { "short": "TEST", "full": "Teams" }, "accentColor": "#FFFFFF", "staticTabs": [ { "entityId": "conversations", "scopes": [ "personal" ] }, { "entityId": "about", "scopes": [ "personal" ] }, { "entityId": "com.contoso.teamsauthsample.static", "name": "Auth Tab", "contentUrl": "https://0e9efa6a1a73.ngrok.io/api/healthcheck", "scopes": [ "personal" ] } ], "bots": [ { "botId": "XXXX-3cac-4c8d-bd6b-XXXX", "scopes": [ "personal" ], "supportsFiles": false, "isNotificationOnly": false } ], "permissions": [ "identity", "messageTeamMembers" ], "validDomains": [ "en-in.xxxx.com", "www.xxxxx.com", "dev.xx.xxx.com", "token.botframework.com", "*.ngrok.io" ], "webApplicationInfo": { "id": "XXXX-50f6-4d38-9ec0-XXXX", "resource": "api://0e9efa6a1a73.ngrok.io/XXX-50f6-4d38-9ec0-XXXXX" } }
What were you expecting to happen?
We are looking for SSO in teams channel.
Please suggest us on getting the tokens for the MS teams channel. And also please suggest the recommended manifest.json file.
Thanks,
Sreekanth (Ecolab)
The text was updated successfully, but these errors were encountered: