microsoft / botbuilder-java

The Microsoft Bot Framework provides what you need to build and connect intelligent bots that interact naturally wherever your users are talking, from text/sms to Skype, Slack, Office 365 mail and other popular services.
http://botframework.com
MIT License
178 stars 115 forks source link

[OAuthPrompt] The call to https://api.botframework.com/api/usertoken/GetToken returns a 500 response #1490

Closed pastox closed 1 year ago

pastox commented 1 year ago

Github issues should be used for bugs and feature requests. Use Stack Overflow for general "how-to" questions.

Version

4.14.1

Describe the bug

I've been trying to use the bot samples in java, especially the bot-authentication one, which uses the SDK version 4.14.1

When using the OAuthPrompt Dialog from the SDK, the call to https://api.botframework.com/api/usertoken/GetToken performed by the SDK returns a 500 status error response. According to the code, the SDK awaits either a 200 or 404 status. This is probably an issue with the api but I'm posting here.

To Reproduce

Steps to reproduce the behavior:

  1. Follow the instructions at https://learn.microsoft.com/en-us/azure/bot-service/bot-builder-authentication?view=azure-bot-service-4.0&tabs=multitenant%2Caadv2%2Cjava
  2. Test the bot-authentication sample
  3. You should see the prompt Welcome to AuthenticationBot. Type anything to get logged in. Type 'logout' to sign-out.
  4. Type anything except logout
  5. The Auth Prompt should appear but nothing happens
  6. Start again with the debugger active with a breakpoint at com.microsoft.bot.connector.rest.RestUserToken on the first line of the method ServiceResponse<TokenResponse> getTokenDelegate(Response<ResponseBody> response)
  7. Observe a 500 status in the response with the error body
    {
    "error": {
    "code": "ServiceError",
    "message": "Error retrieving token: 59966167e635c640bc5061aa7a2084ba."
    }
    }

    Maybe I configured my Azure resources badly, but at least I would expect a client error status

Expected behavior

The API returns 404 and the Oauth prompt shows on the chat

Screenshots

If applicable, add screenshots to help explain your problem.

Additional context

Add any other context about the problem here.

InfinytRam commented 1 year ago

Thank you @pastox, we are investigating.

InfinytRam commented 1 year ago

Hi @pastox,

I was not able to reproduce this issue using java bot sample 18.bot-authentication.

image

Followed the Create the Azure AD identity provider documentation to authenticate the bot.

InfinytRam commented 1 year ago

Hi @pastox, any updates on this?

pastox commented 1 year ago

Hello @ramfattah thank you for your answer. Another colleague of mine tried to follow the same steps and reproduced the issue.

So we think it might be a problem related to our Azure organization/subscription. Do you know of any configuration differences in the Azure accounts/permissions/subscriptions that could cause such issues ?

Thank you in advance.

InfinytRam commented 1 year ago

Hi @pastox,

InfinytRam commented 1 year ago

Closing due Inactivity. @pastox please re-open if needed.