Forum Discussion
OAuth client for API-based message extension
Hello everyone, Is it possible to use OAuth client described here https://dev.teams.microsoft.com/oauth-configuration for API-based Teams message extension? Looks like there is no option for this in the App manifest.
Thanks!
- Sayali-MSFTMicrosoftkirylkalasouski-Thanks for reporting your issue.
We will check this at our end and will get back to you. - Sayali-MSFTMicrosoft
Yes, it is possible to use the OAuth client described on the developer portal for API-based Teams message extensions. The OAuth client allows you to support external or third-party OAuth providers, such as Google, GitHub, LinkedIn, and Facebook, using the updated
authenticate()
API. This API supports external OAuth providers by adding specific parameters to the authentication process.Support Third Party OAuth Providers - Teams | Microsoft Learn
For more detailed guidelines on implementing OAuth for API-based message extensions, you can refer to the API-based Message Extension Guidelines
- kirylkalasouskiCopper Contributor
Thank you Sayali-MSFT ! What should be specified in the App manifest then? Developer portal generates the following configuration which is invalid for 1.17 schema. I was not able to find any intructions for this in the provided articles. Thanks!
- Sayali-MSFTMicrosoft
To ensure your OAuth client for API-based message extension is valid for the 1.17 schema, you need to update your app manifest accordingly. Here are the key elements you should include in your manifest:
-
Schema Reference: Ensure your manifest references the correct schema URL:
{ "$schema": "https://developer.microsoft.com/json-schemas/teams/v1.17/MicrosoftTeams.schema.json", "manifestVersion": "1.17", ... }
-
Authorization Property: Add the
authorization
property undercomposeExtensions
to define the type of authentication for your application:{ "composeExtensions": [ { "authorization": { "authType": "OAuth", "oauth2": { "clientId": "YOUR_CLIENT_ID", "scopes": ["SCOPE1", "SCOPE2"], "redirectUri": "YOUR_REDIRECT_URI" } }, ... } ], ... }
-
Bot ID: Ensure you have the
botId
specified undercomposeExtensions
:{ "composeExtensions": [ { "botId": "YOUR_BOT_ID", ... } ], ... }
-
Commands: Define the commands your message extension will support:
{ "composeExtensions": [ { "commands": [ { "id": "exampleCmd1", "title": "Example Command", "type": "query", "context": ["compose", "commandBox"], "description": "Command Description; e.g., Search on the web", "initialRun": true, "fetchTask": false, "parameters": [ { "name": "keyword", "title": "Search keywords", "inputType": "choiceset", "description": "Enter the keywords to search for", "value": "Initial value for the parameter", "choices": [ { "title": "Title of the choice", "value": "Value of the choice" } ] } ] } ], ... } ], ... }
For more detailed guidelines, you can refer to the App Manifest Reference
and the API-based Message Extension Guidelines
-