May 19 2022 10:12 PM - edited May 19 2022 10:13 PM
I have a teams bot which I want to use as an interface for my service stack webservice however the token I have access to is not being accepted by the web service.
I followed the "AAD SSO for tabs and message extension" tutorial to set up my Azure instance and get a basic bot up and running. When I modified the query handler to send a request to a web service with the token provided it is responding with a login page.
This is the code that I added to the Simple Graph Client in a new method which passes in what the user types as query
HttpWebRequest request = (HttpWebRequest)WebRequest.Create("https://<my website>/api/ws/v1/search?query=" + query);
request.Headers.Add("Authorization", "Bearer " + _token);
request.Method = "GET";
request.AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate;
using (System.Net.HttpWebResponse response = (HttpWebResponse)request.GetResponse())
using (Stream stream = response.GetResponseStream())
using (StreamReader reader = new StreamReader(stream))
{
return reader.ReadToEnd();
}
Do I need to make use of a shared certificate? or is there some additional configuration that I have missed which is necessary to make this situation work?
May 19 2022 10:35 PM
May 20 2022 04:12 AM
May 23 2022 04:37 AM
May 23 2022 06:30 PM
@Sayali-MSFT We managed to get our integration working by modifying our oath connection setting from api://<guid> to api://<guid>/access_as_user
The only thing we are missing now is that our jwt token appears to be missing the email address associated with the user.
May 23 2022 11:31 PM - edited May 24 2022 12:02 AM
@BazVanDenDungen-When a user asks the bot to do something that requires the bot to have the user logged in, the bot can use an OAuthPrompt to initiate retrieving a token for a given connection.When you start an OAuth prompt, it waits for a token response event, from which it will retrieve the user's token.
Ref Doc:-Add authentication to a bot in Bot Framework SDK - Bot Service | Microsoft Docs
Jun 21 2022 11:14 PM
Jun 28 2022 05:08 PM
@Sayali-MSFT We were able to resolve our issue thanks