Skip to content

How to use Teams API as a User using Application Credentials

Phase 1: Register the Application in Microsoft Entra ID

Section titled “Phase 1: Register the Application in Microsoft Entra ID”
  1. Create the App Registration

    • Navigate to App registrations in the Microsoft Entra admin center.
    • Click New registration (or verify current details if editing an existing one).
    • Enter a Name for your application.
    • Under Supported account types, select “Accounts in this organizational directory only” (Single tenant).
    • Once created, go to the Overview page.
    • Copy and save the Application (client) ID and Directory (tenant) ID. You will need these later.

    Copy save

  2. Configure Authentication (Redirect URI)

    • Go to the Authentication blade in the left menu.
    • Click Add a platform and select Web.
    • In the Redirect URIs field, enter your application’s callback URL, it will follow this pattern: https://credentials-{environment}.mindflow.io/oauth2/callback.
    • Ensure the URI matches exactly what your application expects for the OAuth handshake.

    Ensure uri matches exactly what your

  3. Generate a Client Secret

    • Navigate to Certificates & secrets in the left menu.
    • Click New client secret.
    • Enter a Description (e.g., “New client secret”) and select an expiration period.
    • Click Add.
    • Important: Copy the Value of the secret immediately. It will be hidden after you leave this page.

    Click add

You must configure the app to have Delegated permissions so it can act on behalf of a signed-in user.

  1. Add Permissions

    • Navigate to API permissions in the left menu.
    • Click + Add a permission.
    • Select Microsoft Graph.

    Select microsoft graph

    • Choose Delegated permissions.

    Choose delegated permissions

    • Search for and select the following permissions:
Permission NameTypeDescriptionAdmin Consent Required
Channel———
Channel.ReadBasic.AllDelegatedRead names and descriptions of channelsNo
ChannelMember.Read.AllDelegatedRead members of channelsYes
ChannelMessage.Read.AllDelegatedRead user channel messagesYes
ChannelMessage.ReadWriteDelegatedRead and write user channel messagesYes
ChannelMessage.SendDelegatedSend channel messagesNo
Chat———
Chat.CreateDelegatedCreate chatsNo
Chat.ReadDelegatedRead user chat messagesNo
Chat.ReadWriteDelegatedRead and write user chat messagesNo
ChatMember.ReadDelegatedRead members of chatsYes
ChatMember.ReadWriteDelegatedAdd/remove members from chatsYes
ChatMessage.ReadDelegatedRead user chat messagesNo
ChatMessage.SendDelegatedSend user chat messagesNo
Group & Team———
Group-Conversation.Read.AllDelegatedRead group conversationsYes
Group-Conversation.ReadWrite.AllDelegatedRead/write group conversationsYes
Team.ReadBasic.AllDelegatedRead names/descriptions of teamsNo
TeamMember.Read.AllDelegatedRead members of teamsYes
User & Access———
User.ReadDelegatedSign in and read user profileNo
offline_accessDelegatedMaintain access to dataNo
  1. Grant Admin Consent

    • After adding the permissions, you will see a status warning “Not granted for [Your Org]” for permissions requiring admin consent.
    • Click the Grant admin consent for [Your Organization] button to approve these permissions for the tenant.

    Click grant admin consent your organization

    • The status should change to “Granted for [Your Organization]” with a green checkmark.

Phase 3: Configure Credentials in Application

Section titled “Phase 3: Configure Credentials in Application”

Now, connect your external application (e.g., Mindflow) to the Azure app you just created.

  1. Create New Credential

    • In your application, navigate to the credential creation page.

    Your application navigate credential creation

    • Service: Select Microsoft Graph - Teams.

    Your application navigate credential creation

    • Credential Name: Give it a recognizable name.
    • URL: https://graph.microsoft.com/v1.0.
  2. Enter OAuth Details

    • Client ID: Paste the Application (client) ID from Phase 1.
    • Client Secret: Paste the Secret Value from Phase 1.
    • Authorization URL: https://login.microsoftonline.com/{tenant—id}/oauth2/v2.0/authorize.
    • Access Token URL: https://login.microsoftonline.com/{tenant—id}/oauth2/v2.0/token.
    • Callback URL: Ensure this matches the Redirect URI set in Phase 1 (e.g., https://credentials-{environment}.mindflow.io/oauth2/callback).

    Callback url

    • Now, the Application is set. From now on, users from this Microsoft tenant will be able to create a credential more easily, by just sign in into that app. No need for multiple Entra App.
  3. Sign in the App

    • Now, as the user who wants to use Teams as themselves, create a new credential.

    Now user who wants use teams

    • Select Teams

    Select teams

    • Here, you should see Sign in with Microsoft Graph - Teams.

    Here you should see sign microsoft

    • Click on this and you will be redirected to a Microsoft login page. Log in with the appropriate user account.
    • Upon success, you should see a message like “Authorization Successful!”.

    Upon success you should see message

    • Now, your user credential is set. Upon running, it will use your identity to perform actions on the target resources, in this instance Teams, with the scopes attributed in the first steps of this tutorial.
  • To test that newly created credential, head on to Flows and create a Flow.

  • Create and run a test action, such as “List teams” from Teams API.

    Create run test action such list

  • Check the logs for a 200 OK status code, confirming the permission setup is correct and the token is valid.

    Check logs 200 ok status code