在政府云中,机器人中的用户身份验证中未经授权的错误(GCC High)
我遇到未经授权的错误,下面给出了机器人设置详细信息。我在商业Azure尝试了相同的设置,并且正在工作。问题仅在GCC High Azure中。
Azure Portal(Portal.azure.us)中的机器人设置
- 在Azure Portal中创建了Azure Bot。
- 在Bot Azure应用中添加新客户秘密。
- 在身份验证设置中添加了重定向的URI,“ https://tokengcch.botframework.azure.us/.auth/web/redirect”
- 在Azure Portal中的bot Configuration中
- 配置的消息传递端点
- 创建的OAuth连接设置 - 测试连接工作。
使用的TeamSauth
- 更新的AppSettings.json文件。
- microsoftappid
- MicrosoftappPassword
- ConnectionName
- 名称名为本文。 (尝试此代码,也没有尝试过)
字符串uri =“ https://apigcch.botframework.azure.us”; MicrosoftappCredentials.trustserviceurl(URI); authclientconfig.oauthendpoint = uri;
我按照文档仍然遇到错误。
返回了无效状态代码'badgateway'badgateway'
microsoft.bot.schema.schema.errorrepsessexception:操作在Microsoft.bot.bot.connector.conversations.replytoctivitywithhttpmessagessasync
使用Bot Framework SDK版本SDK版本4.16- starmup.cs Files > services.addsingleton< botframeworkauthentication,configurationBotframeworkauthentication>();
- 按照以下文章添加的配置设置
{“ MicrosoftAppid”:“ DB9C0376-41C2-41C2-4ABC-BEE6-A1C2F64B4F61”,“ MicrosoftappPasspassword”:“ AD8 ...”,“ ConnectionName”:“ CCSGRAPHAUTH” azure.us”,“ oauthurl”:“ https://tokengcch.botframework.azure.us/”,“ tochannelfrombotloginurl”:“ https://logogin.microsoftonline.us/microsoftonline.us/microsoftserceserfsices..onmiccrosost.onmiccrosofteroft.anmiccrosoft.usoft.usoft.us.us.us.us.us.us ,, “ https://api.botframework.us”,“ tobotfromchanneltokenissuer”:“ https://api.botframework.us”,“ tobotfromchannelopenidmetadatatataTataTataTaTaTaTaTaTaTaTaTaTaTaTaTaTaTaTaTaTaTaTAtaURl”:已知/openIdConfiguration“,” tobotfromulatoropenidmetadataurl':“ https://login.microsoftonline.us/cab8a31a-1906-4287-a0d87-a0d8-a0d8-4eef66666666b955f6b955f6e/
我尝试了团队和Web聊天频道中的机器人。在两个异常消息中获得低于excetion
:microsoft.rest.httpoperationException:操作在Microsoft.bot.bot.connector.oauthclient.getSignInResourcewithhhtttppmessagesagessync(string state state state,String string codechalleenge2 codorcrect,string emuloreRerl,emuloreRerl,emuloreRerl,emulorerl,emulirectrection.getSignInResclient.getSignInRecrectrect)返回了无效的状态代码。 customHeaders, CancellationToken cancellationToken) at Microsoft.Bot.Connector.BotSignInExtensions.GetSignInResourceAsync(OAuthClient operations, String state, String codeChallenge, String emulatorUrl, String finalRedirect, CancellationToken cancellationToken) at Microsoft.Bot.Connector.Authentication.UserTokenClientImpl.GetSignInResourceAsync(String connectionName,活动活动,字符串finalredirect,concellationToken concellationToken)在Microsoft.bot.builder.dialogs.usertokenaccess.getSignInresourCeasync(iturnContext Turncontext,oauth turncontext,oauthpromptsettings concellationtoken concellationtoken.bother.bots.bot.bot.bot.bot.bot.bot.异步(oauthpromptsettings设置,iturnContext Turncontext, IMessageActivity prompt, CancellationToken cancellationToken) at Microsoft.Bot.Builder.Dialogs.OAuthPrompt.BeginDialogAsync(DialogContext dc, Object options, CancellationToken cancellationToken) at Microsoft.Bot.Builder.Dialogs.DialogContext.BeginDialogAsync(String dialogId, Object options, CancellationToken cancellationToken) at Microsoft.BotBuilderSamples.MainDialog.PromptStepAsync(WaterfallStepContext stepContext, CancellationToken cancellationToken) in D:\Bot\46.teams-auth\Dialogs\MainDialog.cs:line 51 at Microsoft.Bot.Builder.Dialogs.WaterfallDialog.OnStepAsync(WaterfallStepContext stepContext , CancellationToken cancellationToken) at Microsoft.Bot.Builder.Dialogs.WaterfallDialog.RunStepAsync(DialogContext dc, Int32 index, DialogReason reason, Object result, CancellationToken cancellationToken) at Microsoft.Bot.Builder.Dialogs.WaterfallDialog.BeginDialogAsync(DialogContext dc, Object options ,cancellationToken concellationToken)at microsoft.bot.builder.dialogs.dialogcontext.begindialogasync(字符串dialogid,对象选项,cancellationToken concellation tocellationToken)>
I am getting Unauthorized error, bot setup details are given below. I have tried the same setup in commercial azure and it's working. Issue is only in GCC High Azure.
bot Setup in Azure portal (portal.azure.us)
- Created Azure Bot in Azure portal.
- Add new client secret in Bot Azure App.
- Added redirect URI in authentication settings "https://tokengcch.botframework.azure.us/.auth/web/redirect"
- In Bot configuration in Azure portal
- Configured Messaging endpoint
- Created oAuth connection setting - Test Connection is working.
Used TeamsAuth Sample code.
- Updated AppSettings.json file.
- MicrosoftAppId
- MicrosoftAppPassword
- ConnectionName
- Added this code in startup.cs file as per this Article. (tried this and without this code also)
string uri = "https://apiGCCH.botframework.azure.us"; MicrosoftAppCredentials.TrustServiceUrl(uri); AuthClientConfig.OAuthEndpoint = uri;
I have made changes as per the document and still getting error.
Microsoft.Bot.Schema.ErrorResponseException: Operation returned an invalid status code 'BadGateway' at Microsoft.Bot.Connector.Conversations.ReplyToActivityWithHttpMessagesAsync
- Using Bot Framework SDK version 4.16
- Startup.cs file has this line:
services.AddSingleton<BotFrameworkAuthentication, ConfigurationBotFrameworkAuthentication>();
- Added configuration setting as per article as given below
{ "MicrosoftAppId": "db9c0376-41c2-4abc-bee6-a1c2f64b4f61", "MicrosoftAppPassword": "ad8...", "ConnectionName": "ccsGraphAuth", "ChannelService": "https://botframework.azure.us", "OAuthUrl": "https://tokengcch.botframework.azure.us/", "ToChannelFromBotLoginUrl": "https://login.microsoftonline.us/MicrosoftServices.onmicrosoft.us", "ToChannelFromBotOAuthScope": "https://api.botframework.us", "ToBotFromChannelTokenIssuer": "https://api.botframework.us", "ToBotFromChannelOpenIdMetadataUrl": "https://login.botframework.azure.us/v1/.well-known/openidconfiguration", "ToBotFromEmulatorOpenIdMetadataUrl": "https://login.microsoftonline.us/cab8a31a-1906-4287-a0d8-4eef66b95f6e/v2.0/.well-known/openid-configuration", "ValidateAuthority": true }
I have tried the bot in Teams and Web chat Channels. getting below excetion in both
Exception Message: Microsoft.Rest.HttpOperationException: Operation returned an invalid status code 'Unauthorized' at Microsoft.Bot.Connector.OAuthClient.GetSignInResourceWithHttpMessagesAsync(String state, String codeChallenge, String emulatorUrl, String finalRedirect, Dictionary2 customHeaders, CancellationToken cancellationToken) at Microsoft.Bot.Connector.BotSignInExtensions.GetSignInResourceAsync(OAuthClient operations, String state, String codeChallenge, String emulatorUrl, String finalRedirect, CancellationToken cancellationToken) at Microsoft.Bot.Connector.Authentication.UserTokenClientImpl.GetSignInResourceAsync(String connectionName, Activity activity, String finalRedirect, CancellationToken cancellationToken) at Microsoft.Bot.Builder.Dialogs.UserTokenAccess.GetSignInResourceAsync(ITurnContext turnContext, OAuthPromptSettings settings, CancellationToken cancellationToken) at Microsoft.Bot.Builder.Dialogs.OAuthPrompt.SendOAuthCardAsync(OAuthPromptSettings settings, ITurnContext turnContext, IMessageActivity prompt, CancellationToken cancellationToken) at Microsoft.Bot.Builder.Dialogs.OAuthPrompt.BeginDialogAsync(DialogContext dc, Object options, CancellationToken cancellationToken) at Microsoft.Bot.Builder.Dialogs.DialogContext.BeginDialogAsync(String dialogId, Object options, CancellationToken cancellationToken) at Microsoft.BotBuilderSamples.MainDialog.PromptStepAsync(WaterfallStepContext stepContext, CancellationToken cancellationToken) in D:\Bot\46.teams-auth\Dialogs\MainDialog.cs:line 51 at Microsoft.Bot.Builder.Dialogs.WaterfallDialog.OnStepAsync(WaterfallStepContext stepContext, CancellationToken cancellationToken) at Microsoft.Bot.Builder.Dialogs.WaterfallDialog.RunStepAsync(DialogContext dc, Int32 index, DialogReason reason, Object result, CancellationToken cancellationToken) at Microsoft.Bot.Builder.Dialogs.WaterfallDialog.BeginDialogAsync(DialogContext dc, Object options, CancellationToken cancellationToken) at Microsoft.Bot.Builder.Dialogs.DialogContext.BeginDialogAsync(String dialogId, Object options, CancellationToken cancellationToken)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论