Forum Discussion

chetan_sk's avatar
chetan_sk
Copper Contributor
Sep 11, 2023

Aunthentication for the App to post message and files in the specific teams channel

Hi Team, 

 

We have the requirement to use the miscrosoft graph API in python to post the files and messages to the MS teams channel.

 

We found out that before using the app to authenticate , you need to provide below permissions to the registered app like below

 

 

However as we belive these permissions will be for all the channels with in the organisation if our admin team gives them, 

 

Can you please let us me know how do we give permissions specific to the single channel ? because if its for all the channels in the teams its serious security and IT related issue and we cannot provide those wide permisisons to it.

 

OR is there any other way to authenticate apart from the registered App ?  Where we can use any techincal user , if it is , then it would be good to get some documents with some example as there is no document I found online regarding any other way of authenticating.

 

TIA,

Chetan

 

4 Replies

    • chetan_sk's avatar
      chetan_sk
      Copper Contributor
      Hi Sayali,

      Thankyou for your response but that we are already doing, my question is not with respect to the code, my question is specific to the request_adapter in the above code.

      the authentication which we do , is via registered App as shown in my question and in screeenshot, and if we give permissions, that will be for all the Team channels in the organization,

      Can you please let us me know how do we give permissions specific to the single channel ? . or is there any other way to authenticate instead or register APP, if there is a way , can you please give example ?
      • Sayali-MSFT's avatar
        Sayali-MSFT
        Icon for Microsoft rankMicrosoft

        chetan_sk - To grant permissions specific to a single channel in Microsoft Teams, you can use Resource-specific consent (RSC). RSC allows your app to use API endpoints to manage specific resources, such as teams or chats, within an organization.

        Here are the steps to grant RSC permissions to your Teams app for a single channel:

        1. Add RSC permissions to your Teams app:

          • In your Teams app's manifest file, add the required resourceSpecificApplicationPermissions property.
          • Specify the API permissions that your app requires for the specific channel.
          • For example, if your app needs to read and write messages in a channel, you would add the ChannelMessage.Read.All and ChannelMessage.Send permissions.
        2. Install your app in the channel:

          • Once you have added the RSC permissions to your app, you need to install the app in the specific channel where you want to grant permissions.
          • You can install the app using the Teams client or programmatically using the Microsoft Graph API.
        3. Verify app RSC permission granted to your app:

          • After installing the app in the channel, you can verify if the RSC permissions have been granted to your app.
          • You can check the app's permissions using the Microsoft Graph API or the Teams admin center.

        By following these steps, you can grant specific permissions to your Teams app for a single channel. This allows your app to access and manage resources within that channel based on the granted permissions.

        For more detailed information and code examples, you can refer to the following documentation:

         

Resources