MicrosoftDocs / msteams-docs

Source for the Microsoft Teams developer platform documentation.
https://aka.ms/teamsdev
Creative Commons Attribution 4.0 International
289 stars 513 forks source link

Teams Notification Bot SSO Connection Setting Could Not Found #7407

Closed SURYASARAVANAN closed 1 year ago

SURYASARAVANAN commented 2 years ago

I created a bot using teams tool kit in notification configuration with functions. now i add the sso for the bot to accquire teams current user access token refered this doc.following this registered bot app registered in ad and client secret created then i create azure bot for sso provider from that i have update the teams app manifest in vs code for webapplicationinfo and domains but now i'm getting could not find connection setting "connectionname" error in OAuthPrompt with beginDialog. Any one faced this issue Also refered

ghost commented 2 years ago

Hi SURYASARAVANAN! Thank you for bringing this issue to our attention. We will investigate and if we require further information we will reach out in one business day. Please use this link to escalate if you don't get replies.

Best regards, Teams Platform

Meghana-MSFT commented 2 years ago

Can you please confirm if you have added the OAuth connection in your bot. Please refer this section - https://learn.microsoft.com/en-us/microsoftteams/platform/bots/how-to/authentication/auth-aad-sso-bots#update-the-azure-portal-with-the-oauth-connection.

The OAuth connection name needs to be added to .env file as mentioned in the document https://learn.microsoft.com/en-us/training/modules/msteams-sso/7-exercise-bots-sso image

SURYASARAVANAN commented 2 years ago

Yes i done that already but still i get that error. image

One more thing I'm using teams toolkit with vs code. when run the bot locally, it register an app in AAD under my login user id tenant also it register bot in developer teams portal. if i try to create azure bot service for teams channel registeration using existing AAD app create by teams tool kit it throws error like already app registered with another bot. image

so then first i try to create azure bot with create new app and multi tenant after it deploy i set the bot app id , client secret in teams bot project .fx/config.local.json in "bot" config and try to debug the bot locally it throws BT.ProvisionError Developer Portal Registeration failed. image help me how to add sso for notification bot using teams tool kit

Meghana-MSFT commented 2 years ago

@SURYASARAVANAN - We will set it up and check it and get back to you.

SURYASARAVANAN commented 2 years ago

@Meghana-MSFT For your reference, i have given the OAuth prompt dialog request for bot framework.

DialogContextError: Could not find Connection Setting with name teamsAuth [2022-11-08T12:43:59.188Z] at D:\NotificationBot\NotificationBotOriginal\BotTest\bot\node_modules\botbuilder-dialogs\lib\dialogContext.js:40:19 [2022-11-08T12:43:59.192Z] at Generator.throw () [2022-11-08T12:43:59.193Z] at rejected (D:\NotificationBot\NotificationBotOriginal\BotTest\bot\node_modules\botbuilder-dialogs\lib\dialogContext.js:6:65) [2022-11-08T12:43:59.194Z] at processTicksAndRejections (node:internal/process/task_queues:96:5) { [2022-11-08T12:43:59.196Z] error: RestError: Could not find Connection Setting with name teamsAuth [2022-11-08T12:43:59.198Z] at new RestError (D:\NotificationBot\NotificationBotOriginal\BotTest\bot\node_modules\botbuilder\node_modules\@azure\ms-rest-js\dist\msRest.node.js:2480:28) [2022-11-08T12:43:59.203Z] at D:\NotificationBot\NotificationBotOriginal\BotTest\bot\node_modules\botbuilder\node_modules\@azure\ms-rest-js\dist\msRest.node.js:3687:37 [2022-11-08T12:43:59.208Z] at processTicksAndRejections (node:internal/process/task_queues:96:5) { [2022-11-08T12:43:59.211Z] code: 'ServiceError', [2022-11-08T12:43:59.212Z] statusCode: 400, [2022-11-08T12:43:59.213Z] request: WebResource { [2022-11-08T12:43:59.215Z] streamResponseBody: false, [2022-11-08T12:43:59.217Z] url: 'https://api.botframework.com/api/botsignin/GetSignInResource?state=eyJDb25uZWN0aW9uTmFtZSI6ImJvdGNvbm5lY3Rpb24iLCJDb252ZXJzYXRpb24iOnsiYWN0aXZpdHlJZCI6ImY6NGNkMjNjOGMtMDcxZS1hNzA4LWZhODYtNTc2MjI1ZDRjOTI0IiwidXNlciI6eyJpZCI6IjI5OjFIazVZb3pnTkJxdE0yUk54aTlJSWNQeFZzREQ3WXBYTkltdUhROHV6UjVXbktjWmZBSnFVR0Q2LUFXeVR6OHJKNXdlWWZYTDh2V2UzSlkwWGVfZGNLdyIsIm5hbWUiOiJTdXJ5YSBTYXJhdmFuYW4iLCJhYWRPYmplY3RJZCI6ImVkMzEwOTRlLTMwMzItNDU5ZC1iZGFmLTAyNjkwMDk5YThjYiJ9LCJib3QiOnsiaWQiOiIyODo1MTlhYzg4OC0yNmY2LTQzZTgtYWY5OC0zOTQ4MjNkNWNlMzciLCJuYW1lIjoiZW1wb3dlcmJvdC1sb2NhbC1kZWJ1ZyJ9LCJjb252ZXJzYXRpb24iOnsiY29udmVyc2F0aW9uVHlwZSI6InBlcnNvbmFsIiwidGVuYW50SWQiOiI5NTE2NjE5OC1iODY1LTQyOTQtOGQxMS00OTZjODViNzk3OGEiLCJpZCI6ImE6MWJTUGFVbzFJOWNhWGdnVTBTdVU3d2Z5QVYxTVh5c0xsVmdNNTJheVBHdUF0YWRmOThiNlZ2V2JYdk9qWkxyLVFScHFmWmxGTHRBaDZUNnJTUWc1WGVjMT....', [2022-11-08T12:43:59.221Z] method: 'GET', [2022-11-08T12:43:59.222Z] headers: [HttpHeaders], [2022-11-08T12:43:59.223Z] body: undefined, [2022-11-08T12:43:59.225Z] query: undefined, [2022-11-08T12:43:59.226Z] formData: undefined, [2022-11-08T12:43:59.227Z] withCredentials: false, [2022-11-08T12:43:59.228Z] abortSignal: undefined, [2022-11-08T12:43:59.229Z] timeout: 0, [2022-11-08T12:43:59.230Z] onUploadProgress: undefined, [2022-11-08T12:43:59.231Z] onDownloadProgress: undefined, [2022-11-08T12:43:59.234Z] proxySettings: undefined, [2022-11-08T12:43:59.237Z] keepAlive: undefined, [2022-11-08T12:43:59.239Z] agentSettings: undefined, [2022-11-08T12:43:59.240Z] redirectLimit: undefined, [2022-11-08T12:43:59.242Z] operationSpec: [Object] [2022-11-08T12:43:59.243Z] }, [2022-11-08T12:43:59.244Z] response: { [2022-11-08T12:43:59.245Z] body: '{\r\n' + [2022-11-08T12:43:59.246Z] ' "error": {\r\n' + [2022-11-08T12:43:59.247Z] ' "code": "ServiceError",\r\n' + [2022-11-08T12:43:59.254Z] ' "message": "Could not find Connection Setting with name teamsAuth"\r\n' + [2022-11-08T12:43:59.256Z] ' }\r\n' + [2022-11-08T12:43:59.259Z] '}', [2022-11-08T12:43:59.261Z] headers: [HttpHeaders], [2022-11-08T12:43:59.263Z] status: 400 [2022-11-08T12:43:59.265Z] }, [2022-11-08T12:43:59.270Z] body: undefined [2022-11-08T12:43:59.271Z] }, [2022-11-08T12:43:59.272Z] dialogContext: { [2022-11-08T12:43:59.273Z] activeDialog: 'OAuthPrompt', [2022-11-08T12:43:59.274Z] parent: 'MainDialog', [2022-11-08T12:43:59.275Z] stack: [ [Object], [Object] ] [2022-11-08T12:43:59.276Z] } [2022-11-08T12:43:59.277Z] }

SURYASARAVANAN commented 2 years ago

@Meghana-MSFT,did you find the solution?

Meghana-MSFT commented 2 years ago

@SURYASARAVANAN - We are checking this internally. We will get back to you. Thank you.

Adding this reference - https://learn.microsoft.com/en-us/microsoftteams/platform/toolkit/add-single-sign-on

SURYASARAVANAN commented 2 years ago

@Meghana-MSFT I tried this teamsBotPrompt using teamsfxsdk which you mentioned in above document. i'm using javascript project scaffold for notification bot in that try to add sso with teamsfx cli "teamsfx add sso".In result generated sample is for tab application in react.js, please check this also and updated the document.bot-sso not getting create by teamsfx version 1.2.1 bot-sso sample repo

Meghana-MSFT commented 2 years ago

Apologies for the delay in response. We are checking internally and update you back.

therealjohn commented 2 years ago

@SURYASARAVANAN

Unfortunately, I am not sure how to resolve the issue. To get the best support, please file an issue in the TeamsFx repo so our team can triage and help.

https://github.com/OfficeDev/TeamsFx/issues

SURYASARAVANAN commented 1 year ago

I have found an alternate way using TeamsBotSSOPrompt function by registering AAD App for bot auth. https://github.com/OfficeDev/TeamsFx-Samples/tree/dev/bot-sso, thanks for your time.

ghost commented 1 year ago

Tell us about your experience!

Hi SURYASARAVANAN! This issue is closed in our system. We would like your feedback on your experience with our support team and Platform.

Best regards, Teams Platform