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

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

Closed tbrendle closed 1 year ago

tbrendle commented 1 year ago

🚨 The issue tracker is not for questions 🚨

If you have a question, please ask it on https://stackoverflow.com/questions/tagged/botframework

[question]

There seems to be an issue in either the SDK or the documentation relating to :

It seems that the api endpoint uses a default value https://api.botframework.com instead of https://europe.api.botframework.com

This issue has been described here : https://github.com/microsoft/botbuilder-js/issues/4418, and answered by @ramfattah

How could I change the endpoint with the Java SDK ?

Thank you in advance

InfinytRam commented 1 year ago

Hi @tbrendle, I'm investigating further on this. Thanks.

InfinytRam commented 1 year ago

Hey @tbrendle,

To verify, are you using singletenant or multitenant bot type?

tbrendle commented 1 year ago

I'm using multitenant bot type

InfinytRam commented 1 year ago

Thanks @tbrendle,

In C# and JavaScript bots, adding the following configurations in appsettings.json or .env file solved the Europe region OAuth issue:

BotOpenIdMetadata=https://login.botframework.com/v1/.well-known/openidconfiguration
ValidateAuthority=true
ToChannelFromBotLoginUrl=https://login.microsoftonline.com/botframework.com
ToChannelFromBotOAuthScope=https://api.botframework.com
ToBotFromChannelTokenIssuer=https://api.botframework.com
OAuthApiEndpoint=https://europe.api.botframework.com
ToBotFromChannelOpenIdMetadataUrl=https://login.botframework.com/v1/.well-known/openidconfiguration
ToBotFromEmulatorOpenIdMetadataUrl=https://login.microsoftonline.com/botframework.com/v2.0/.well-known/openid-configuration
CallerId=urn:botframework:azure

Adding the same configuration to Java bot (in application.properties) did not seem to work. Not sure how these parameters are passed in Java SDK.

Discussing internally with engineers regarding this issue. Will report back soon.

InfinytRam commented 1 year ago

Note: the solution in https://github.com/microsoft/botbuilder-js/issues/4418 is for Bots that implement CloudAdapter.

Looks like the Java sample 46.teams-auth is using BotFrameworkHttpAdapter.

johnataylor commented 1 year ago

The ability to use alternative auth endpoints and other constants is not available in Java (aka CloudAdapter), the Java SDJK is not currently undergoing active feature development so that won't change in this particular library code.