It's 2025, and there seems to be no out of the box solution or an online documentation advising how to manage multi-tenant applications just like the OP's scenario. I know a lot of time has passed, but I wanted to registerd on here just to provide a solution for future devs in the same situation.
Our custom application (tab on an existing bot app) required users to login to their own platform. this required SSO, and SSO is usually blocked due to CORS when navigating within the iFrame that the tab renders.
To go about this, we launch a popup microsoftTeams.authentication.authenticate
where the targetURL was on a domain that's found under the ValidDomains (same as the tab's url). this targetURL was a redirect page that passed all necessary parameters to the actual page we wanted (since the actual destination was not part of the ValidDomains, so notifySuccess()
wouldn't have worked after a login). Then, once the SSO login was complete, the page sends the data encrypted to a "finish.html" script that called the notifySuccess
or notifyFailure
callback back to microsoftTeams.authentication.authenticate
.
So, in our case, we went around the validDomains
manifest submission for over 500+ domains.