> ## Documentation Index
> Fetch the complete documentation index at: https://docs.stackone.com/llms.txt
> Use this file to discover all available pages before exploring further.

# OneDrive Partner OAuth

> Follow these steps to connect OneDrive via the StackOne Hub successfully.

<Warning>
  Ensure that your Microsoft account has the [**Global Administrator**](https://learn.microsoft.com/en-us/microsoft-365/admin/add-users/about-admin-roles?view=o365-worldwide#permissions-based-on-admin-role-and-group-type-in-m365-admin-page) and [**OneDrive Administrator**](https://learn.microsoft.com/en-us/sharepoint/sharepoint-admin-role) roles assigned.

  You can view and manage user role assignments in your [Microsoft Admin center](https://admin.microsoft.com/Adminportal/Home#/users).
</Warning>

<Info>
  For users outside of your organization to connect with your Microsoft application, a Microsoft Partner Center account is required. [Read more](https://learn.microsoft.com/en-gb/entra/identity-platform/publisher-verification-overview)

  Your Microsoft application must have your **MPN ID** assigned under *Branding & Properties* > *Publisher Verification:*

  <Frame>
    <img src="https://mintcdn.com/stackone-60/F56lKiTjQ7ATW2YT/images/sharepoint-mpn-.png?fit=max&auto=format&n=F56lKiTjQ7ATW2YT&q=85&s=219250b11fbf8a2f10bd775b6f7a30a6" alt="Publisher Verification section showing the MPN ID field" width="774" height="211" data-path="images/sharepoint-mpn-.png" />
  </Frame>
</Info>

If you've been directed to StackOne to integrate with OneDrive, the following steps will help you understand the process and any necessary actions to configure a successful integration.

## Create and Configure a New Application

<Steps>
  <Step title="Log in to Microsoft Azure">
    Log in to your [Microsoft Azure](https://portal.azure.com/) portal.

    <Frame>
      <img src="https://mintcdn.com/stackone-60/SJYqWv54Bsiau7aR/images/azure-login.png?fit=max&auto=format&n=SJYqWv54Bsiau7aR&q=85&s=bf9b796e9eed7e6a798112c3108da698" alt="Microsoft Azure portal sign-in page" width="494" height="578" data-path="images/azure-login.png" />
    </Frame>
  </Step>

  <Step title="Navigate to App Registrations">
    Go to your [Microsoft Entra admin center](https://entra.microsoft.com/).

    In the left navigation bar, click "Applications" > "App registrations".

    <Frame>
      <img src="https://mintcdn.com/stackone-60/EZ7nWzE-JJzhmP-C/images/ms-entra-app-registrations.png?fit=max&auto=format&n=EZ7nWzE-JJzhmP-C&q=85&s=a3c038dd5777dcb7747b6bf3082e4633" alt="App registrations under Applications in the Microsoft Entra admin center navigation" width="339" height="865" data-path="images/ms-entra-app-registrations.png" />
    </Frame>
  </Step>

  <Step title="Register a New Application">
    Under ***App Registrations***, click the "+ New registration" button.

    <Frame>
      <img src="https://mintcdn.com/stackone-60/EZ7nWzE-JJzhmP-C/images/ms-entra-new-app-registration-btn.png?fit=max&auto=format&n=EZ7nWzE-JJzhmP-C&q=85&s=d0a95b7845ff6cc2c1602ff7dc6bad25" alt="The New registration button on the App registrations page" width="296" height="196" data-path="images/ms-entra-new-app-registration-btn.png" />
    </Frame>
  </Step>

  <Step title="Configure Application Details">
    Under ***Register an application***, input the following details:

    * Name
    * Supported account types
      * Select "*Accounts in any organizational directory (Any Microsoft Entra ID tenant - Multitenant) and personal Microsoft accounts*"
    * Redirect URI
      * Select "*Web*"
      * Enter the URI: `https://api.stackone.com/connect/oauth2/onedrive/callback`

    Once complete, click "Register" to create the new application.

    <Frame>
      <img src="https://mintcdn.com/stackone-60/EZ7nWzE-JJzhmP-C/images/ms-entra-new-app-docs-sharepoint-details.png?fit=max&auto=format&n=EZ7nWzE-JJzhmP-C&q=85&s=12a2c67f601951dcb4c48f64eccf4208" alt="Register an application form with the name, multitenant account type, and web redirect URI filled in" width="1113" height="925" data-path="images/ms-entra-new-app-docs-sharepoint-details.png" />
    </Frame>
  </Step>

  <Step title="Obtain the App Client ID and Tenant ID">
    After registration, you'll be taken to the application overview page.

    **Copy** <Icon icon="clipboard" color="#333333" /> the following values and store them safely to be used in a later step:

    * Application (client) ID
    * Directory (tenant) ID

    <Frame>
      <img src="https://mintcdn.com/stackone-60/EZ7nWzE-JJzhmP-C/images/ms-entra-app-client-id-sharepoint.png?fit=max&auto=format&n=EZ7nWzE-JJzhmP-C&q=85&s=ea4ec84b27bfe0198dcbd1edc3dabe01" alt="Application overview page showing the Application (client) ID and Directory (tenant) ID" width="2736" height="934" data-path="images/ms-entra-app-client-id-sharepoint.png" />
    </Frame>
  </Step>

  <Step title="Obtain the Application Client Secret">
    Under *Client credentials* on the right, click "Add a certificate or secret".

    <Frame>
      <img src="https://mintcdn.com/stackone-60/EZ7nWzE-JJzhmP-C/images/ms-entra-app-click-client-secret-.png?fit=max&auto=format&n=EZ7nWzE-JJzhmP-C&q=85&s=48d47da2bc8928a738b886ac0ea20073" alt="Certificates and secrets page with the New client secret option" width="1283" height="509" data-path="images/ms-entra-app-click-client-secret-.png" />
    </Frame>

    Under *Client secrets*, click the "+ New client secret" button.

    <Frame>
      <img src="https://mintcdn.com/stackone-60/EZ7nWzE-JJzhmP-C/images/ms-entra-new-app-client-secret-sharepoint.png?fit=max&auto=format&n=EZ7nWzE-JJzhmP-C&q=85&s=78e84bb61182dbffd03f472283fdf913" alt="Add a client secret panel with the description and expiry fields" width="888" height="552" data-path="images/ms-entra-new-app-client-secret-sharepoint.png" />
    </Frame>

    Under *Add a client secret*, enter a description and select your desired expiration date for this secret.

    <Info>
      Please keep in mind that a new secret will need to be generated when this one expires.
    </Info>

    Click the "Add" button to proceed.

    <Frame>
      <img src="https://mintcdn.com/stackone-60/EZ7nWzE-JJzhmP-C/images/ms-entra-new-client-secret-details-sharepoint.png?fit=max&auto=format&n=EZ7nWzE-JJzhmP-C&q=85&s=37055da49b6f1db2f4d2a86b52ce1823" alt="The new client secret listed with its value and expiry date" width="1135" height="918" data-path="images/ms-entra-new-client-secret-details-sharepoint.png" />
    </Frame>

    The new client secret will be displayed. **Copy** <Icon icon="clipboard" color="#333333" /> the **Value** and store it safely to be used in a later step.

    <Warning>
      Make sure to copy this value now. It will not be displayed again.
    </Warning>

    <Frame>
      <img src="https://mintcdn.com/stackone-60/EZ7nWzE-JJzhmP-C/images/ms-entra-copy-client-secret-value.png?fit=max&auto=format&n=EZ7nWzE-JJzhmP-C&q=85&s=4376044c7d70a48ff5e5c7b2eb452934" alt="Copying the client secret value before navigating away from the page" width="1200" height="271" data-path="images/ms-entra-copy-client-secret-value.png" />
    </Frame>
  </Step>

  <Step title="Set the Application API Permissions">
    Click "API permissions" near the left navigation.

    <Frame>
      <img src="https://mintcdn.com/stackone-60/EZ7nWzE-JJzhmP-C/images/ms-entra-app-api-permissions-.png?fit=max&auto=format&n=EZ7nWzE-JJzhmP-C&q=85&s=eebcd62b5171e1c3d06413004609479c" alt="API permissions page with the Add a permission option" width="614" height="836" data-path="images/ms-entra-app-api-permissions-.png" />
    </Frame>

    Under *Configured permissions*, click the "Add a permission" button.

    <Frame>
      <img src="https://mintcdn.com/stackone-60/EZ7nWzE-JJzhmP-C/images/ms-entra-add-app-api-permission-sharepoint.png?fit=max&auto=format&n=EZ7nWzE-JJzhmP-C&q=85&s=5c70f2e7b09118793036fea80b505813" alt="Request API permissions panel with Microsoft Graph selected" width="359" height="215" data-path="images/ms-entra-add-app-api-permission-sharepoint.png" />
    </Frame>

    Under *Request API permissions*, click "Microsoft Graph".

    <Frame>
      <img src="https://mintcdn.com/stackone-60/EZ7nWzE-JJzhmP-C/images/ms-entra-app-api-permissions-microsoft-gro.png?fit=max&auto=format&n=EZ7nWzE-JJzhmP-C&q=85&s=eb9e23ea1f01f8dcae6bb0941b459b66" alt="Microsoft Graph delegated permissions list with the required scopes selected" width="734" height="475" data-path="images/ms-entra-app-api-permissions-microsoft-gro.png" />
    </Frame>

    The application requires the following permissions.

    **Delegated Permissions**

    * **Files.Read** - Read user files
    * **Files.Read.All** - Read all files that user can access
    * **Files.ReadWrite** - Read and upload user files
    * **offline\_access** - Maintain access to data you have given it access to
    * **Sites.Read.All** - Read items in all site collections
    * **Sites.ReadWrite.All** - Edit or delete items in all site collections
    * **User.Read** - Sign in and read user profile
    * **User.ReadBasic.All** - Read all users' basic profiles

    After selecting all of the listed permissions above, click the "Add permissions" button.

    <Frame>
      <img src="https://mintcdn.com/stackone-60/EZ7nWzE-JJzhmP-C/images/ms-entra-app-api-permissions-sharepoint.png?fit=max&auto=format&n=EZ7nWzE-JJzhmP-C&q=85&s=531ddaad1fb0d3c698fbe8cb2f1f3c08" alt="Configured permissions list showing every required Microsoft Graph permission" width="614" height="836" data-path="images/ms-entra-app-api-permissions-sharepoint.png" />
    </Frame>
  </Step>

  <Step title="Grant Admin Consent for Application Permissions">
    All of the added permissions will be listed under *Configured permissions*. Please ensure that all of the permissions above are listed.

    Click the "Grant admin consent" button to approve all of the listed permissions.

    Click the "Yes" button to confirm Admin approval.

    <Frame>
      <img src="https://mintcdn.com/stackone-60/EZ7nWzE-JJzhmP-C/images/ms-entra-confirm-admin-consent-.png?fit=max&auto=format&n=EZ7nWzE-JJzhmP-C&q=85&s=734f429501f74c5ca5e6acd10d332721" alt="Grant admin consent confirmation dialog" width="966" height="176" data-path="images/ms-entra-confirm-admin-consent-.png" />
    </Frame>
  </Step>

  <Step title="Add Single-Page Application Redirect URI">
    To support the File Picker, an additional Redirect URI is required for the Single-Page Application platform configuration.

    Navigate to **Authentication** under *Manage*, and click the "Add a platform" button.

    <Frame>
      <img src="https://mintcdn.com/stackone-60/F56lKiTjQ7ATW2YT/images/share-point-auth-add-platform-btn.png?fit=max&auto=format&n=F56lKiTjQ7ATW2YT&q=85&s=986c6298fd8947441269769fb3f5cc82" alt="The Add a platform button on the Authentication page" width="1102" height="466" data-path="images/share-point-auth-add-platform-btn.png" />
    </Frame>

    Under *Configure Platforms* on the right, click **Single-page application**.

    <Frame>
      <img src="https://mintcdn.com/stackone-60/F56lKiTjQ7ATW2YT/images/sharepoint-spa-platform.png?fit=max&auto=format&n=F56lKiTjQ7ATW2YT&q=85&s=7c7f2b09153d7bc3028f13b6e818e996" alt="Configure platforms panel with Single-page application selected" width="623" height="415" data-path="images/sharepoint-spa-platform.png" />
    </Frame>

    Enter the following **Redirect URI**:\
    `https://app.stackone.com`

    <Frame>
      <img src="https://mintcdn.com/stackone-60/F56lKiTjQ7ATW2YT/images/sharepoint-spa-redirect.png?fit=max&auto=format&n=F56lKiTjQ7ATW2YT&q=85&s=ad086f831e6bb8ff93ab621f9ae9b426" alt="Single-page application redirect URI field" width="631" height="476" data-path="images/sharepoint-spa-redirect.png" />
    </Frame>

    Press the "**Configure**" button to continue, then the "**Save**" button in the *Authorization* screen you are returned to.
  </Step>
</Steps>

## Get your OneDrive base URL

Your OneDrive base URL follows this format:

```
https://{your-domain}.sharepoint.com
```

You can find this URL by:

1. Opening your Microsoft OneDrive site
2. Copying the base URL from your browser's address bar

## Available data

This integration has the following [Documents resources](/documents/introduction) available from the provider:

* Drives
* Files
* Folders
