Connect Microsoft 365 using your own OAuth app

5 min read

Use your own Microsoft Entra app to control the app name users see and the permissions your integration requests. One Microsoft 365 auth config connects Composio to the Microsoft Graph services your users authorize.

Before you begin

  • A Composio project.

  • Permission to register an app in Microsoft Entra ID.

  • A Microsoft account with access to the services you plan to use.

NOTE: Teams, SharePoint, and Bookings workflows also depend on your organization’s service access and licenses.

Part 1: Register your Microsoft Entra app

Step 1: Copy the redirect URI from Composio

  1. In your Composio project, open Auth Configs → Create. Search for Microsoft 365 and select the unified toolkit.

    Search for Microsoft 365 and select the unified OAuth 2.0 toolkit
  2. Enter a config name and select Next. Select Your Own Credentials and copy the Redirect URI. Keep this tab open.

    Name the Microsoft 365 auth config and continue to credentials

The current form shows the redirect URI below. Use the exact URL from your own form when registering the app.

https://backend.composio.dev/api/v1/auth-apps/add
Select Your Own Credentials and copy the Microsoft 365 Redirect URI

Step 2: Register the app

  1. Sign in to the Microsoft Entra admin center. Select the directory that will own the app, then open Entra ID → App registrations → New registration.

    Open App registrations and select New registration in Microsoft Entra
  2. Enter an app name. Under Supported account types, choose who can connect. For customers in different organizations, select Accounts in any organizational directory. If your workflows support personal Microsoft accounts too, choose the option that includes them.

  3. If the form shows a tenant-access choice, select Allow all tenants for customers across organizations, or specify the customer tenant IDs your app should accept.

  4. Under Redirect URI, choose Web and paste the URL copied from Composio. Select Register. On the app’s Overview page, copy the Application (client) ID. For details, see Microsoft app registration instructions.

    Register an application with supported account types and a Web redirect URIFind the Application client ID on the app Overview page

Step 3: Create a client secret

  1. Open Certificates & secrets → Client secrets → New client secret. Add a description, choose an expiry allowed by your organization, and select Add.

    Open New client secret and choose a description and expiration
  2. Copy the new secret’s Value immediately and store it securely. Composio needs this value in its Client secret field. Record the expiry so you can replace it before it expires. For details, see Microsoft credential instructions.

    Copy the new client secret from the Value column and store it securely

Step 4: Choose the Graph permissions your workflows need

  1. Open API permissions → Add a permission → Microsoft Graph → Delegated permissions. Choose permissions for the actions your integration will perform, then select Add permissions.

    Select Microsoft Graph delegated permissions for an app that acts on behalf of the signed-in user

For the profile check in this guide, the minimum Graph data permission is User.Read. Add offline_access to the Composio auth config so it can request refresh tokens and maintain the connection.

The table gives common starting points. Check the specific action’s requirements when you choose permissions. For details, see Microsoft Graph permissions reference.

Workflow

Example delegated permissions

Signed-in user profile

User.Read

Outlook mail

Mail.ReadBasic for basic message details, Mail.Read for message content, Mail.Send to send mail

Calendar

Calendars.ReadBasic for basic event details, Calendars.Read for full details, Calendars.ReadWrite to edit events

Contacts

Contacts.Read to read, Contacts.ReadWrite to edit

OneDrive, Word, and PowerPoint files

Files.Read to read the user’s files, Files.ReadWrite for file changes. Accessing other shared files can require broader file or site permissions.

Excel workbook operations

Files.ReadWrite for workbook APIs, including reading cell ranges

OneNote

Notes.Read to read, Notes.ReadWrite to edit

Teams

Team.ReadBasic.All to list joined teams, Chat.Read to read the user’s chats, ChannelMessage.Read.All to read channel messages

SharePoint sites and lists

Sites.Read.All to read, Sites.ReadWrite.All to edit site content accessible to the user

Microsoft To Do

Tasks.Read to read, Tasks.ReadWrite to edit

Microsoft Bookings

Bookings.Read.All to read, Bookings.ReadWrite.All to edit booking information

NOTE: Shared mailboxes, shared calendars, and other users’ resources can require additional permissions and resource access. In particular, Excel’s range API requires Files.ReadWrite even for a read. For details, see Excel range permissions.

Step 5: Check whether admin consent is required

In API permissions, check the Admin consent required column. Some delegated permissions, such as ChannelMessage.Read.All, require an administrator. Your organization can also require admin approval for permissions that normally allow user consent.

Review the app's configured delegated permissions and the Admin consent required column

When approval is required, an authorized administrator reviews the requested access and selects Grant admin consent for your organization. For a multitenant app, each customer organization grants its own approval. For details, see Grant tenant-wide admin consent.

NOTE: If Microsoft shows Need admin approval during connection, use your organization’s approval process before reconnecting. For details, see How user and admin consent work.

Part 2: Connect and test in Composio

Step 1: Save your custom auth config

  1. Return to the Microsoft 365 form in Composio. Enter the Entra Application (client) ID and the client secret’s Value. Confirm that the Redirect URI matches the Web redirect URI registered in Entra.

  2. Under Scopes, request the delegated permissions your workflows need. For this walkthrough, use User.Read and offline_access. Review any preselected scopes, then select Create Auth Config.

    Microsoft 365 custom OAuth config with User.Read and offline_access selected for the profile check

Step 2: Connect a Microsoft account

  1. Open the saved auth config and select Connect Account. Sign in with the intended Microsoft account, review the app name and requested permissions, and accept the access you want to grant.

    Open the saved Microsoft 365 custom auth config and select Connect AccountMicrosoft consent for reading the signed-in user's profile and maintaining access
  2. Return to Composio and open Connected Accounts. Confirm that the account’s status is Active.

    The Microsoft 365 connected account is Active in Composio

Step 3: Run a read-only profile test

Use Composio’s SDK or Tools Execute API to run Get User Profile, tool MICROSOFT_365_GET_MY_PROFILE. Pass the new connected account ID and the application user ID used when creating the connection. Set the tool’s user_id argument to me. For details, see Execute a Composio tool.

For the Tools Execute API, pass your application user ID as entity_id. Use these tool arguments for this check:

{
  "user_id": "me",
  "select": "id,displayName,userPrincipalName"
}

Confirm that successful is true and that the returned profile matches the Microsoft account you connected. After that, test one read-only action for each service your application will use.

NOTE: When you add permissions later, update the auth config and reconnect so Microsoft can grant the new access. Existing connections keep their previous grants until authorization completes again.

Troubleshooting

  • For Redirect URI mismatch, compare the exact Composio URL with the app’s Authentication → Web redirect URI.

  • For Invalid client or expired secret, check the client ID, secret value, and expiry. Enter the replacement secret in Composio before reconnecting.

  • For Need admin approval, ask an authorized administrator to review the requested access under the tenant’s consent policy.

  • For Access denied or insufficient privileges, check the action’s delegated scopes, the granted permissions, and the user’s access to the target resource.

  • If a service is unavailable for the account, confirm that the account has the required mailbox, drive, team, or service license.

Share