2
votes

I've created a Bot in MS teams that can authenticate the user against AAD. I've used the AuthBot code for this. This works correctly. I have questions regarding further improving the sign-in experience. The Bot currently opens up a web browser, the user logs in and is redirect to a page with a magic number that he or she needs to copy-paste back into teams.

If I understand the Authentication section on this page correctly, then the following should be possible:

  1. The browser window can be opened inside of Teams instead of through the browser by specifying a validDomains attribute in the Teams package manifest file. However, I chat with the Bot 1:1 and it doesnt seem to use the manifest file (the Bot's image doesnt use the one from the manifest). How do I get the login window to open inside Teams?
  2. There is a MS Teams javascript file. Can I use this (on the page that my Bots shows after authentication) to redirect the user back to teams, and possibly automatically paste the magic number into the chat with the Bot?
1

1 Answers

3
votes

We missed answering this in August, apologies.

A more elegant way of doing bot authentication has been a common developer request. We are almost ready to publish samples and documentation for this solution once it's fully deployed on all client platforms. This approach removes the need for AuthBot completely and supports an integrated authentication experience, i.e. without opening a browser tab.

Currently, however, to answer your question, there is no way to have an inline authentication experience and the validDomains is not enforced (since it's just opening a browser page). The JavaScript client SDK you refer to is not used at all with bots because bots cannot currently run code on the client.

So in other words, what you are doing with AuthBot is currently the best possible way to do it.