botframework - 在 bot builder v4 中下载 Skype bot 附件
问题描述
我正在尝试使用 Bot Builder v4 下载在 Skype bot 中上传的图像。使用 httpClient 下载图像时,我已检索 JwtSecurityToken 进行授权。但有时我会收到未经授权的错误。
var context = stepContext.Context;
var channelId = context.Activity.ChannelId;
if (channelId.Equals("skype"))
{
using (var connectorClient = (ConnectorClient)context.TurnState.First(x => x.Key.Equals("Microsoft.Bot.Connector.IConnectorClient")).Value)
{
if (connectorClient?.Credentials != null)
{
var credentials = (MicrosoftAppCredentials)connectorClient.Credentials;
var authToken = await new MicrosoftAppCredentials(credentials.MicrosoftAppId, credentials.MicrosoftAppPassword).GetTokenAsync().ConfigureAwait(false);
}
}
}
解决方案
推荐阅读
- terraform - 未找到 Terraform- 提供程序配置
- jekyll - Jekyll Liquid 语法,如何取消引用属性
- docker - 在 S6 Overlay 中终止具有 1 个进程的 Docker 容器需要 > 10 秒
- vega-lite - 在 vega-lite 饼图中按大小排序的弧
- python-3.x - Paramiko exec_command 不能与 mkfs 一起使用?
- c# - 有没有办法在 ASP.NET Web API 应用程序中全局限制并行任务的数量?
- shopify - 如何在产品概览中仅显示可用的产品多属性价格
- javascript - NextJS useRouter 在函数体内使用时出错
- reactjs - 来自 API 调用的数据未按要求进入控制台
- mysql - MySQL:仅当该客户同时拥有储蓄账户和支票账户时才尝试查询客户信息