Search code examples
microsoft-teamsmicrosoft-graph-toolkit

Can you use the Microsoft Graph Toolkit in a Teams tab


We are trying to use the Microsoft Graph Toolkit people picker in a Microsoft Teams tab app we are creating. We are writing the app in angular JS hosted in an Azure Web App.

We don't want to prompt the user for their credentials prior to using the people picker, as the user will have already authenticated to access the Microsoft Teams environment.

Is this currently possible? I've seen some posts about MSAL not being able to silently authenticate when running in an iframe, like when using a web hosted app in Teams. Is this also true for the Teams Authentication Provider?

We have verified that we can silently authenticate using ADAL. A login panel flashes up for less than a second, which is mildly annoying, but fine. Can the Microsoft Graph Toolkit use ADAL for it's authentication? Is there another option we should consider?


Solution

  • Yes, you can use it directly in your teams tab app through teams toolkit extension.

    Here is already a graph toolkit people picker sample: https://github.com/OfficeDev/TeamsFx-Samples/tree/dev/graph-toolkit-contact-exporter

    If already have authenticated the user, then you can write your owner auth provider like this one: https://github.com/microsoftgraph/microsoft-graph-toolkit/tree/main/packages/providers/mgt-teamsfx-provider