Forum Discussion
Operation returned an invalid status code 'Forbidden'/'NotFound'
- Sayali-MSFTAug 04, 2022
Microsoft
amatthews-yakchat -It is difficult to find error. Instead of , you can refer the below sample with Azure AD V2, Also compare this code with your own.
Sample Link-Microsoft-Teams-Samples/samples/app-complete-auth/csharp/AppCompleteAuth at main · OfficeDev/Microsoft-Teams-Samples (github.com)
In the below repository, you can call the dialoge BotSsoAuthDialog in PromptStepAsync method. It will return the token and user details.
Dialogs link- Microsoft-Teams-Samples/BotSsoAuthDialog.cs at main · OfficeDev/Microsoft-Teams-Samples (github.com)
Repository Link-Microsoft-Teams-Samples/MainDialog.cs at fb5beb01271099430655ea0e56e8b6230c0e424e · OfficeDev/Microsoft-Teams-Samples (github.com)private async Task<DialogTurnResult> PromptStepAsync(WaterfallStepContext stepContext, CancellationToken cancellationToken) { if(stepContext.Context.Activity.Text == null || stepContext.Context.Activity.Text.ToLower().Trim() == "usingcredentials") { return await stepContext.BeginDialogAsync(nameof(UsernamePasswordAuthDialog)); } if (stepContext.Context.Activity.Text.ToLower().Trim() == "sso" || stepContext.Context.Activity.Text.ToLower().Trim() == "logoutsso") { return await stepContext.BeginDialogAsync(nameof(BotSsoAuthDialog)); } else if (stepContext.Context.Activity.Text.ToLower().Trim() == "facebooklogin" || stepContext.Context.Activity.Text.ToLower().Trim() == "logoutfacebook") { return await stepContext.BeginDialogAsync(nameof(FacebookAuthDialog)); } else { await stepContext.Context.SendActivityAsync(MessageFactory.Attachment(GetLoginOptionCard()), cancellationToken); return await stepContext.EndDialogAsync(); } } - amatthews-yakchatAug 04, 2022Copper ContributorI understand that the error is because ReplyToActivityWithHttpMessagesAsync is returning an invalid code, but we do not call this method directly so I don't understand what we can do to solve this problem?
- Sayali-MSFTAug 02, 2022
Microsoft
According to the above error log, this error response occurs when it returns the invalid status code.
ErrorResponseException-Thrown when the operation returned an invalid status code.
Ref Doc-Conversations.ReplyToActivityWithHttpMessagesAsync Method (Microsoft.Bot.Connector) | Microsoft Docs - amatthews-yakchatAug 02, 2022Copper ContributorI was just wondering if there was any more news on this ongoing issue?
- amatthews-yakchatJul 20, 2022Copper ContributorSorry for the late response, we have tried AAD V2 OAuth service and we still get the same issue.