本文介绍了如何在Bot中实现OAuth流程而不对不支持的通道(例如Zoom和WebEx)使用OAuthPrompt对话框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用OAuthPrompt对话框的现有bot代码,我想为Azure Bot Service不支持的Zoom和WebEx部署该对话框.根据文档和示例代码,我已使用适配器来支持这些通道.它工作正常.但是它不支持OAuthPrompt对话框,它返回"OAuthPrompt.BeginDialog():当前适配器不支持".

I have an existing bot code that uses OAuthPrompt dialog that I would like to deploy for Zoom and WebEx that are not supported by Azure Bot Service. As per the documentation and sample code, I have used the adapter for supporting those channels. It works fine. But it does not support OAuthPrompt Dialog, it returns "OAuthPrompt.BeginDialog(): not supported by the current adapter".

当我使用源代码(Bot Builder SDK/w适配器)进行调试时,"OAuthPrompt实施"对话框会检查适配器是否实现IExtendedUserTokenProvider接口,当前未实现,因此返回错误.如何在不使用OAuthPrompt对话框/Azure Bot服务的情况下添加OAuth卡支持?

When I debugged with the source code (Bot builder SDK /w Adapter), Implementation of OAuthPrompt dialog checks whether adapter implements IExtendedUserTokenProvider interface, currently it is not, so it returns error. How to add OAuth card support without using OAuthPrompt Dialog/Azure Bot Service?

这个问题类似于我的:(是否有使用身份验证的方法服务没有Azure机器人服务?)以下是我的想法:

This question is similar to mine:(Is there any way to use authentication service without azure bot service?)Following are my thoughts:

  1. 使用OURL2代码流的重定向URL(我的机器人端点)直接向身份提供者发送请求.还要使用bot端点在App Registration门户中更新重定向URI,目前,我已将重定向URI提供为"https://token.botframework.com/.auth/web/redirect".用于支持的频道.

  1. Directly send a request to identity provider with redirect URL (my bot endpoint) for OAuth2 code flow. Also update the redirect URI in the App Registration portal with bot endpoint, currently I have provided Redirect URI as "https://token.botframework.com/.auth/web/redirect" for supported channels.

在适配器中实现IExtendedUserTokenProvider(类似于仿真器).

Implement the IExtendedUserTokenProvider in the adapter (similar to Emulator).

任何反馈都值得赞赏.

推荐答案

我可以通过为Zoom自定义OAuthPrompt对话框,在ZoomAdapter(ZoomAdapterWIthErrorHandler)中实现IExtendedUserTokenProvider来使其工作.OAuth连接设置(例如身份服务器端点,范围,重定向uri}存储在appSettings.json中作为连接名称.受支持的渠道(MS Teams和Slack)将使用SDK提供的实现(OAuthPrompt对话框),并配置ConnectionName中的设置在Azure中,不受支持的渠道将从AppSettings.json文件中获取设置.GetSignInResourceAsync()应该具有返回登录资源Uri的正确实现.

I can get it working by having customized OAuthPrompt dialog for Zoom, implementing IExtendedUserTokenProvider in ZoomAdapter (ZoomAdapterWIthErrorHandler). OAuth connection settings (such as identity server endpoint, scopes, redirect uri} are stored in the appSettings.json for the connection name. Supported channels (MS Teams and Slack) will use the SDK provided implementation (OAuthPrompt Dialog) with settings from ConnectionName configured in the Azure, unsupported channels will get the settings from the AppSettings.json file. GetSignInResourceAsync() should have the right implementation that returns the sign-in resource Uri.

这篇关于如何在Bot中实现OAuth流程而不对不支持的通道(例如Zoom和WebEx)使用OAuthPrompt对话框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-18 21:00