@devries-cameron20 / composio Mirror · read-only
Fork 0

Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.

Mirrored from https://github.com/Camo67/composio.git

Synced Nov 21, 06:00 UTC

next
md 89 lines 7.98 KB
Rendered Raw
1 ## How do I set up custom OAuth credentials for SharePoint?
2
3 Use your own Microsoft Entra ID app registration when you want the Microsoft consent screen to show your app's name and you want to control which SharePoint permissions it requests. This applies to the **SharePoint** toolkit, which calls the SharePoint REST API; the separate **SharePoint Graph** toolkit uses Microsoft Graph permissions instead.
4
5 ### Create the Microsoft Entra app
6
7 1. Sign in to the [Azure portal](https://portal.azure.com/), open **App registrations**, and click **New registration**.
8 2. Enter a **Name**. Under **Supported account types**, choose an organizational option: **Accounts in this organizational directory only** (single tenant) or **Accounts in any organizational directory** (multitenant). Allowing personal accounts doesn't give them access to an organizational SharePoint site.
9 3. Under **Redirect URI**, select the **Web** platform, enter `https://backend.composio.dev/api/v1/auth-apps/add`, and click **Register**.
10 4. On the app's **Overview** page, copy the **Application (client) ID**.
11
12 ![Entra app Overview page with the client, object and tenant IDs censored](/images/toolkits/shared/XrRJcE8kllnTRDHzOTTTl8s9oxc.webp)
13
14 5. Open **Certificates & secrets** and click **New client secret**. Add a description, choose an expiry that fits your rotation policy (for example, 180 days), and click **Add**. Rotate the secret before it expires.
15
16 ![Add a client secret panel with a description and the 180-day expiry](/images/toolkits/shared/eZiGGdUoPbOHKz4sCPqGdS04k.webp)
17
18 6. Copy the secret **Value** right away. Use the **Value**, not the **Secret ID**. Azure shows the full value only once; if you lose it, create a new secret.
19
20 ![Client secrets list with the Value and Secret ID columns censored](/images/toolkits/shared/hiQJlSSKAljLV6UM2Wu8e5sUCzU.webp)
21
22 7. Open **API permissions**, click **Add a permission**, select **SharePoint** (not Microsoft Graph), and choose **Delegated permissions**. Add the permissions your tools need, for example `AllSites.Read` for read-only access, and click **Add permissions**. Write, list-management, and admin operations can need more permissions and site or tenant roles.
23
24 ![API permissions page with the Add a permission button](/images/toolkits/share_point/add-a-permission.webp)
25
26 ![Request API permissions panel with SharePoint under Microsoft APIs](/images/toolkits/share_point/sharepoint-api.webp)
27
28 ![SharePoint delegated permissions with AllSites.Read selected](/images/toolkits/share_point/allsites-read-permission.webp)
29
30 ![Configured SharePoint AllSites.Read delegated permission details](/images/toolkits/share_point/allsites-read-details.webp)
31
32 8. Keep **Allow public client flows** disabled on the **Authentication** page. This is a confidential Web client.
33 9. If your tenant restricts user consent, have a tenant admin click **Grant admin consent for** your tenant on the **API permissions** page. Adding a permission to the app registration doesn't grant consent by itself.
34
35 The redirect URI you register must exactly match the `oauth_redirect_uri` field in your Composio auth config (default `https://backend.composio.dev/api/v1/auth-apps/add`).
36
37 ### Create the auth config in Composio
38
39 1. In the Composio dashboard, go to **Auth Configs**, click **Create**, and select **SharePoint**. Enter a config name and click **Next**.
40
41 ![Composio Auth Configs page with the Create button](/images/toolkits/share_point/composio-auth-configs.webp)
42
43 ![Create Auth Config search showing SharePoint and SharePoint Graph as separate toolkits](/images/toolkits/share_point/composio-toolkit-picker.webp)
44
45 ![Auth config name field with the Next button](/images/toolkits/share_point/composio-config-name.webp)
46
47 2. Select **OAuth 2.0** and **Your Own Credentials**. Paste the Application (client) ID into **Client id** and the secret value into **Client secret**. Leave **Redirect URI** as shown.
48
49 ![Composio auth config form with OAuth 2.0 and Your Own Credentials selected](/images/toolkits/share_point/composio-own-credentials.webp)
50
51 3. Under **Scopes**, keep the default `.default` and `offline_access` scopes. The `.default` scope picks up the SharePoint permissions you added in Azure. Click **Create Auth Config**.
52
53 ![Composio auth config with the v1 redirect URI and the tenant-templated .default and offline_access scopes](/images/toolkits/share_point/composio-scopes.webp)
54
55 4. Open the auth config and click **Connect Account**. Enter the **Tenant Name** (`subdomain`) and, optionally, the **SharePoint Subsite** (`generic_id`), then click **Connect Account**. Sign in with a work or school account that can access the site, check that the consent prompt shows your app's name, and click **Accept**. Leave **Consent on behalf of your organization** unchecked unless you're an admin granting tenant-wide consent. An **unverified** label is expected for a custom app without a verified publisher.
56
57 ![SharePoint auth config page with the Connect Account button](/images/toolkits/share_point/composio-connect-account.webp)
58
59 ![Composio connection form with a censored Tenant Name and an empty SharePoint Subsite field](/images/toolkits/share_point/tenant-and-subsite-fields.webp)
60
61 ![Microsoft Pick an account page with the accounts censored](/images/toolkits/shared/1dBnBBEYr17c671yWVLvqnS4k.webp)
62
63 ![Composio page confirming the SharePoint connection](/images/toolkits/share_point/connection-success.webp)
64
65 5. Back on the auth config's **Connected Accounts** tab, confirm the account shows **Active**. The **Enabled** label at the top of the page describes the auth config, not the account.
66
67 ![Connected Accounts tab with the SharePoint account showing Active](/images/toolkits/share_point/connected-account-active.webp)
68
69 For the general flow, see [custom auth configs](/docs/auth-configuration/custom-auth-configs).
70
71 ### Scopes
72
73 The default auth config requests `https://<tenant>.sharepoint.com/.default` (Composio fills in the tenant name you enter when connecting) and `offline_access`. The `.default` scope requests every permission configured on the app registration, not every SharePoint operation. If you reuse an app that has other API permissions, users and admins see those too, so review the full consent prompt. See Microsoft's [.default scope](https://learn.microsoft.com/en-us/entra/identity-platform/scopes-oidc#the-default-scope) reference.
74
75 ### Connection fields
76
77 - **Tenant Name** (`subdomain`, required): the part before `.sharepoint.com` in your site URL, such as `contoso` in `contoso.sharepoint.com`. Enter only the name, not a full URL or a tenant GUID.
78 - **SharePoint Subsite** (`generic_id`): leave it empty for the root site. A bare name such as `marketing` resolves to `/sites/marketing`. For nested subsites or other managed paths, enter the full path, such as `/sites/marketing/archive` or `/teams/engineering`.
79 - The connection's tenant field (`issuer`) defaults to `common`. To restrict sign-in to one tenant, set it to your **Directory (tenant) ID** from the app's **Overview** page or a verified tenant domain.
80
81 ### App-only access (certificate)
82
83 SharePoint also supports an app-only auth mode (`S2S_OAUTH2`) that uses a certificate instead of a client secret. Upload the certificate under **Certificates & secrets** on the app registration, then enter the tenant ID (`generic_id`, a GUID from **Microsoft Entra ID** > **Overview**), the **Client id**, the RSA private key in PEM format (`private_key`), and the certificate's base64url-encoded SHA-256 thumbprint (`cert_thumbprint`). Connections take the same **Tenant Name** and optional site path.
84
85 ## Why does my SharePoint `/teams/...` site resolve as `/sites/...`?
86
87 If a user's SharePoint site URL is under `/teams/<site>` instead of `/sites/<site>`, do not tell them to pass only `<site>` in the SharePoint Subsite field. A bare subsite value is interpreted as `/sites/<site>` by the toolkit.
88
89 Re-initiate or reconnect the SharePoint account and set SharePoint Subsite to the full server-relative path, for example `/teams/<site>`. For per-call overrides, pass `site_name: "/teams/<site>"`.