page_type | description | products | languages | extensions | urlFragment | ||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
sample |
Microsoft Teams tab sample app for demonstrating device permissions |
|
|
|
officedev-microsoft-teams-samples-tab-device-permissions-nodejs |
This sample shows tab device permissions.
It also shows Device permissions for the browser. Please refer Device permissions for browser for more information.
Mobile View
The latest update on how device permissions are handled in the browser is currently available in public developer preview
only.
This update will be generally available (GA) by February 01, 2022
- Microsoft Teams is installed and you have an account (not a guest account)
- NodeJS
- ngrok or equivalent tunneling solution
- M365 developer account or access to a Teams account with the appropriate permissions to install an app.
-
Clone the repository
git clone https://github.com/OfficeDev/Microsoft-Teams-Samples.git
-
In the folder where repository is cloned navigate to
samples/tab-device-permissions/nodejs
. -
Install modules
Inside node js folder, open your local terminal and run the below command to install node modules. You can do the same in Visual studio code terminal by opening the project in Visual studio code
npm install
If you face any dependency error while installing node modules, try using below command
npm install --legacy-peer-deps
-
Run the application in your local terminal (or Visual Studio Code terminal) using following command
npm start
-
Begin your tunnelling service to get an https endpoint. For this example ngrok is used. Start an ngrok tunnel with the following command (you'll need the https endpoint to update the manifest file):
ngrok http 3000 --host-header=localhost
-
Create an app manifest. Navigate to the file, appPackage/manifest.json and change the following:
- <<BASE_URI_DOMAIN>> to your https endpoint from ngrok excluding the "https://" part
- Save the file and zip this file along with both the png icons (located next to it) together to create a manifest.zip file.
-
Upload the
manifest.zip
to Teams (in the left-bottom Apps view, click "Upload a custom app") ans start using the app.
Local Running App:
-
Upload an app package (Zip file created in step 3 above) to Microsoft Teams
-
Go to Device permission tab.
-
Click on respective button to test the scenario. You will get prompt to accept permission request.
-
Device permissions on browser
Similary, you can try out for other features.
Important
Please take a look at notes section in Device Permissions documentation as not all devices support these permissions.
This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.microsoft.com. When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA. This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.