机器人框架单租户机器人到技能通信

问题描述 投票:0回答:1

我正在尝试使用 Single 在 https://github.com/microsoft/BotBuilder-Samples/blob/main/samples/javascript_nodejs/80.skills-simple-bot-to-bot/README.md 运行示例机器人模拟器中的租户模式以及应用程序 ID 和密码。我不断收到未经授权的错误。经过深入研究文档后,添加以下配置行有助于克服未经授权的错误。


    "OAuthUrl": "https://unitedstates.api.botframework.com",
      "ToChannelFromBotOAuthScope": "https://api.botframework.com",
      "ToChannelFromBotLoginUrlTemplate": "https://api.botframework.com",
      "PublicAzureChannel": "https://api.botframework.com",
      "ToBotFromChannelOpenIdMetadataUrl": "https://login.botframework.com/v1/.well-known/openidconfiguration",
      "ToBotFromEmulatorOpenIdMetadataUrl": "https://login.microsoftonline.com/common/v2.0/.well-known/openid-configuration",
      "ToBotFromChannelTokenIssuer": "https://api.botframework.com",
      “ToChannelFromBotLoginUrl”:“https://login.microsoftonline.com/botframework.com”

调整后调用该技能会出现以下错误。

`"label": "TurnError",
  "valueType": "https://www.botframework.com/schemas/error",
  "value": "System.Net.Http.HttpRequestException: Error invoking the skill id: "label": "TurnError",
  "valueType": "https://www.botframework.com/schemas/error",
  "value": "System.Net.Http.HttpRequestException: Error invoking the skill id: \"EchoSkillBot\" at \"http://localhost:39783/api/messages\" (status is 500). 
 Microsoft.IdentityModel.Tokens.SecurityTokenInvalidAudienceException: IDX10208: Unable to validate audience. validationParameters.ValidAudience is null or whitespace and validationParameters.ValidAudiences is null.
   at Microsoft.IdentityModel.Tokens.Validators.ValidateAudience(IEnumerable1 audiences, SecurityToken securityToken, TokenValidationParameters validationParameters)
   at System.IdentityModel.Tokens.Jwt.JwtSecurityTokenHandler.ValidateTokenPayload(JwtSecurityToken jwtToken, TokenValidationParameters validationParameters)
   at System.IdentityModel.Tokens.Jwt.JwtSecurityTokenHandler.ValidateToken(String token, TokenValidationParameters validationParameters, SecurityToken& validatedToken)
   at Microsoft.Bot.Connector.Authentication.JwtTokenExtractor.ValidateTokenAsync(String jwtToken, String channelId, String[] requiredEndorsements)
   at Microsoft.Bot.Connector.Authentication.JwtTokenExtractor.GetIdentityAsync(String scheme, String parameter, String channelId, String[] requiredEndorsements)
   at Microsoft.Bot.Connector.Authentication.JwtTokenExtractor.GetIdentityAsync(String authorizationHeader, String channelId, String[] requiredEndorsements)
   at Microsoft.Bot.Connector.Authentication.ParameterizedBotFrameworkAuthentication.SkillValidation_AuthenticateChannelTokenAsync(String authHeader, String channelId, CancellationToken cancellationToken)
   at Microsoft.Bot.Connector.Authentication.ParameterizedBotFrameworkAuthentication.JwtTokenValidation_AuthenticateTokenAsync(String authHeader, String channelId, String serviceUrl, CancellationToken cancellationToken)
   at Microsoft.Bot.Connector.Authentication.ParameterizedBotFrameworkAuthentication.JwtTokenValidation_ValidateAuthHeaderAsync(String authHeader, String channelId, String serviceUrl, CancellationToken cancellationToken)
   at Microsoft.Bot.Connector.Authentication.ParameterizedBotFrameworkAuthentication.JwtTokenValidation_AuthenticateRequestAsync(Activity activity, String authHeader, CancellationToken cancellationToken)
   at Microsoft.Bot.Connector.Authentication.ParameterizedBotFrameworkAuthentication.AuthenticateRequestAsync(Activity activity, String authHeader, CancellationToken cancellationToken)
   at Microsoft.Bot.Builder.CloudAdapterBase.ProcessActivityAsync(String authHeader, Activity activity, BotCallbackHandler callback, CancellationToken cancellationToken)
   at Microsoft.Bot.Builder.Integration.AspNet.Core.CloudAdapter.ProcessAsync(HttpRequest httpRequest, HttpResponse httpResponse, IBot bot, CancellationToken cancellationToken)
   at Microsoft.BotBuilderSamples.EchoSkillBot.Controllers.BotController.PostAsync() in D:\\bot\\bot\\80.skills-simple-bot-to-bot\\EchoSkillBot\\Controllers\\BotController.cs:line 30
   at lambda_method4(Closure , Object )
   at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.AwaitableResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Logged|12_1(ControllerActionInvoker invoker)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeNextActionFilterAsync>g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeInnerFilterAsync>g__Awaited|13_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeFilterPipelineAsync>g__Awaited|20_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Logged|17_1(ResourceInvoker invoker)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Logged|17_1(ResourceInvoker invoker)
   at Microsoft.AspNetCore.Routing.EndpointMiddleware.<Invoke>g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)
   at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)`

我不确定有效受众配置在这里意味着什么。

  1. 我们如何确保配置正确使用单租户而不通过botframework路线?使用这种方式需要我们在App授权中开启多租户支持。
  2. 需要提供哪些有效受众以及在哪里可以配置?
c# botframework
1个回答
0
投票

我们如何确保配置正确使用单租户 不通过botframework路线?使用这种方法 要求我们在App中开启多租户支持 授权。

模拟器不支持单租户 https://learn.microsoft.com/en-us/azure/bot-service/abs-quickstart?view=azure-bot-service-4.0&tabs=usersigned#managing-resources

“不经过botframework路线”是什么意思?

© www.soinside.com 2019 - 2024. All rights reserved.