Pages Menu
TwitterRssFacebook

Posted by on Apr 3, 2022 in Development, Microsoft Teams

Changed Device Permissions for Teams Apps in Browser now GA

Changed Device Permissions for Teams Apps in Browser now GA

The way that Teams developers need to handle device permissions requests for apps when they are running in a web browser has changed, with previously Preview functionality now GA.

This affects permission to use device capabilities like cameras and microphones. There’s a different model for requesting permissions on mobile, this change is for when apps are running in a web browser. Previously, the browser would have handled the request.

Now, however, Microsoft Teams handles the browser’s request, so by the time your app runs it’s very likely that the user will already have consented to use their video and microphone.

This means that you need to tell Teams that your app needs these permissions, and then make sure that your user has given permission. Importantly, there will not be an obvious pop up. You (the developer) will need to instruct your user what to do.

Telling Teams your app needs permissions

There is a new section of the application manifest where you can specify which device permissions your application needs:

"devicePermissions": [
    "media",
    "geolocation",
    "notifications",
    "midi",
    "openExternal"
]

You can also select these device permissions in the Teams Developer Portal when configuring your app:

Making sure users grant the permission

When your app is running in the Teams client (either desktop or mobile) users will be prompted for permission by Teams.

However, when running Teams in the browser, they will not. They will need to manually grant permission, and your app will need to prompt them to do this.

Here’s a standard Teams app running in the browser. Can you see where the user needs to go in order to grant permission?

It’s actualy the icon in the far top-right, next to the re-load icon, that looks like a shield. Remember, users need to be told to click this themselves, the browser or Teams will no longer prompt. Here is how Microsoft recommend that you bring this to user’s attention:

It’s also worth knowing that (as described in the message) once the user has granted permissions, the app will reload, so users may need guidance that they will have to return to where they were in the app to continue.

Everything just described is for personal apps running in the browser. If your app is a Chat, Channel or Meeting tab then the App Permission link is located in the drop-down menu for the tab:

If your application can be run in either mode … then you might have some fairly complex instructions to present to your users! Or, if you can determine where you application is running, you can present a appropriate customised message directing users to the right place.

Remember, users need to go and select this option themselves, in order for your app to get the permissions it needs!

References with more detail and samples:

docs: Device permissions for the browser – Teams | Microsoft Docs

code sample: Microsoft-Teams-Samples/samples/tab-device-permissions/nodejs at main · OfficeDev/Microsoft-Teams-Samples (github.com)

walkthrough: Tab device permissions – Teams | Microsoft Docs

Written by Tom Morgan

Tom is a Microsoft Teams Platform developer and Microsoft MVP who has been blogging for over a decade. Find out more.
Buy the book: Building and Developing Apps & Bots for Microsoft Teams. Now available to purchase online with free updates.

Post a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.