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

# OneDrive Personal

> Access the OneDrive Personal API in 2 minutes 💨

> [tab] 🚀 Quickstart
>
> **1. Create an integration**
>
> In Nango ([free signup](https://app.nango.dev)), go to [Integrations](https://app.nango.dev/dev/integrations) -> *Configure New Integration* -> *OneDrive Personal*.
>
> > [!NOTE]
> >
> > Nango has a [Nango-managed OAuth app](https://nango.dev/docs/guides/auth/auth-guide.md#nango-managed-oauth-apps) you can use in development and production. Select it when you create the integration.
>
> **2. Authorize OneDrive**
>
> Go to [Connections](https://app.nango.dev/dev/connections) -> *Add Test Connection* -> *Authorize*, then log in to your OneDrive Personal account. Later, you'll let your users do the same directly from your app.
>
> **3. Call the OneDrive API**
>
> Let's make your first request to the OneDrive API (get drive information). Replace the placeholders below with your [Environment API key](https://nango.dev/docs/reference/backend/http-api/api-keys.md), [integration ID](https://app.nango.dev/dev/integrations), and [connection ID](https://app.nango.dev/dev/connections):
>
> > [tab] cURL
> >
> > ```bash theme={null}
> > curl "https://api.nango.dev/proxy/v1.0/drive" \
> >   -H "Authorization: Bearer <NANGO-API-KEY>" \
> >   -H "Provider-Config-Key: <INTEGRATION-ID>" \
> >   -H "Connection-Id: <CONNECTION-ID>"
> > ```
>
> > [tab] Node
> >
> > Install Nango's backend SDK with `npm i @nangohq/node`. Then run:
> >
> > ```typescript theme={null}
> > import { Nango } from '@nangohq/node';
> >
> > const nango = new Nango({ apiKey: '<NANGO-API-KEY>' });
> >
> > const res = await nango.get({
> >     endpoint: '/v1.0/drive',
> >     providerConfigKey: '<INTEGRATION-ID>',
> >     connectionId: '<CONNECTION-ID>'
> > });
> >
> > console.log(JSON.stringify(res.data, null, 2));
> > ```
>
> Or fetch credentials dynamically via the [Node SDK](https://nango.dev/docs/reference/backend/backend-sdk/node.md#get-a-connection-with-credentials) or [API](https://nango.dev/docs/reference/backend/http-api/connections/get.md).
>
> ✅ You're connected! Check the [Logs](https://app.nango.dev/dev/logs) tab in Nango to inspect requests.
>
> > [!TIP]
> >
> > Next step: [Embed the auth flow](https://nango.dev/docs/guides/primitives/auth.md) in your app to let your users connect their OneDrive accounts.

> [tab] 🧑‍💻 OAuth app setup
>
> **1. Create a Microsoft account and Azure account**
>
> If you don't already have them, sign up for a [Microsoft account](https://account.microsoft.com/account) and an [Azure account](https://azure.microsoft.com/free).
>
> **2. Register an application in Microsoft Entra ID**
>
> 1. Sign in to the [Microsoft Entra admin center](https://entra.microsoft.com) as at least an Application Developer.
> 2. If you have access to multiple tenants, use the Settings icon in the top menu to switch to the tenant in which you want to register the application.
> 3. From the search bar at the top of the Azure portal, search for **App registrations** and select it. Then choose **New registration**. Or from your left navigation tab, navigate to **Applications** > **App registrations** then choose **New registration**.
> 4. Enter a meaningful name for your application, for example "Nango Integration".
> 5. Under **Supported account types**, select the appropriate option based on your needs:
>    * **Personal Microsoft accounts only** - For apps that only need to access OneDrive Personal accounts.
>    * **Accounts in any organizational directory and personal Microsoft accounts** - For multitenant apps that support both organizational and personal Microsoft accounts.
> 6. Leave the **Redirect URI** section blank for now; we'll configure it in a later step.
> 7. Click **Register** to complete the app registration.
>
> **3. Note your application (client) ID**
>
> After registration, you'll be taken to the application's Overview page. Record the **Application (client) ID**, which uniquely identifies your application and is used in your application's code as part of validating security tokens.
>
> **4. Add a redirect URI**
>
> 1. In the left sidebar, select **Authentication**.
> 2. Under **Platform configurations**, select **Add a platform**.
> 3. Select **Web** as the platform type.
> 4. Enter `https://api.nango.dev/oauth/callback` as the Redirect URI.
> 5. Under **Implicit grant and hybrid flows**, check the boxes for **Access tokens** and **ID tokens** if your application needs them.
> 6. Under **Advanced settings**, set **Allow public client flows** to **No** for web applications.
> 7. Click **Configure** to save your changes.
>
> **5. Create a client secret**
>
> 1. In the left sidebar, select **Certificates & secrets**.
> 2. Under **Client secrets**, click **New client secret**.
> 3. Enter a description for the secret and select an expiration period (6 months, 12 months, 24 months, or custom).
> 4. Click **Add**.
> 5. **Important**: Copy the secret value immediately and store it securely. You won't be able to see it again after you leave this page.
>
> **6. Next**
>
> Follow the [*Quickstart*](https://nango.dev/docs/getting-started/quickstart.md).
>
> ## Common Scopes
>
> | Scope | Description |
> | - | - |
> | `OneDrive.Read` | Read the signed-in user's OneDrive files |
> | `OneDrive.ReadWrite` | Read and write the signed-in user's OneDrive files |
> | `OneDrive.AppFolder` | Read and write files in the application's special OneDrive folder |
> | `offline_access` | Access to refresh tokens for offline access |
>
> ## Complete Integration Implementation
>
> For a complete, production-ready implementation of OneDrive Personal integration with Nango, check out the **[Nango Sample App](https://nango.dev/docs/getting-started/sample-app.md)**.
>
> The sample app provides:
>
> * Full OAuth flow implementation
> * OneDrive file picker integration
> * File syncing with webhooks
> * File download functionality
> * Complete frontend and backend code examples
>
> You can also watch a [demo video walkthrough](https://youtu.be/oTpWlmnv7dM) or view the [GitHub repository](https://github.com/NangoHQ/sample-app).
>
> > [!TIP]
> >
> > The sample app is the fastest way to get started with OneDrive Personal integration. It includes all the code you need and can be customized for your specific use case.

> [tab] 🔗 Useful links
>
> | Topic | Links |
> | - | - |
> | General | [Microsoft Entra Admin Center](https://entra.microsoft.com) |
> | | [Azure Portal](https://portal.azure.com) |
> | Developer | [Microsoft identity platform documentation](https://learn.microsoft.com/en-us/entra/identity-platform/) |
> | | [How to register an Application](https://learn.microsoft.com/en-us/entra/identity-platform/quickstart-register-app) |
> | | [OAuth 2.0 Authorization Code Flow](https://learn.microsoft.com/en-us/entra/identity-platform/v2-oauth2-auth-code-flow) |
> | | [OneDrive API for Consumer accounts](https://learn.microsoft.com/en-us/onedrive/developer/rest-api/concepts/direct-endpoint-differences?view=odsp-graph-online#onedrive-personal-accounts) |
> | | [OneDrive Permissions](https://learn.microsoft.com/en-us/onedrive/developer/rest-api/concepts/direct-endpoint-differences?view=odsp-graph-online#permissions) |
> | | [OneDrive Consumer Configuration for the File Picker](https://learn.microsoft.com/en-us/onedrive/developer/controls/file-pickers/?view=odsp-graph-online#onedrive-consumer-configuration) |
>
> > [!NOTE]
> >
> > Contribute useful links by [editing this page](https://github.com/nangohq/nango/tree/master/docs/integrations/all/one-drive-personal.mdx)

> [tab] 🚨 API gotchas
>
> * Make sure you request the `offline_access` scope to get a refresh token and keep access with your integration.
> * OneDrive Personal uses `https://api.onedrive.com` as its base URL for API calls.
> * If you need a user to reauthenticate or accept updated scopes, you can force a prompt using the `authorization_params`. Use `prompt=login` to force the user to enter their credentials (bypassing single sign-on) or `prompt=consent` to trigger the OAuth consent dialog after sign-in, which asks the user to grant permissions to the app. For more details, see [Microsoft's OAuth 2.0 authorization documentation](https://learn.microsoft.com/en-us/entra/identity-platform/v2-oauth2-auth-code-flow#request-an-authorization-code).
>
> ```typescript theme={null}
> const { data } = await nango.createConnectSession({
>   [...],
>   integrations_config_defaults: {
>     "one-drive-personal": {
>       authorization_params: {
>         "prompt": "consent" // or "login" depending on your needs
>       }
>     }
>   }
> });
> ```
>
> > [!NOTE]
> >
> > Contribute API gotchas by [editing this page](https://github.com/nangohq/nango/tree/master/docs/integrations/all/one-drive-personal.mdx)

> [!NOTE]
>
> Questions? Join us in the [Slack community](https://nango.dev/slack).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.