Hello,
We are currently working on allowing our webapp to be hosted within Microsoft Teams.
We need to detect whether the app is being hosted by teams so that we can adjust our auth flows and page styling.
Is there any way to detect whether the website is currently iframed within MS teams?
We've tried using the @microsoft/teams-js library by calling microsoftTeams.getContext() but it only returns values if the app is within teams, but there's no failure callback. This means that to use it we have to do a setTimeout and just guess that if getContext() hasn't returned within a certain amount of time that it's not going to return. This blocks our app from loading and is also a bit flakey since there's no guarantee that the timeout we choose will be long enough.
Is there a better way to detect whether the app is hosted by teams?