Cloud Storage

OneDrive Integration

6 min read Updated Apr 13, 2026

Overview

The WPDM OneDrive add-on enables serving files from Microsoft OneDrive, including personal accounts and OneDrive for Business. Integrate with Microsoft 365, leverage enterprise security features, and manage files through the familiar OneDrive interface.

Prerequisites

Before you begin, ensure you have:

  • WordPress 5.0 or higher
  • WordPress Download Manager plugin (Free or Pro)
  • A Microsoft account (personal or Microsoft 365/Business)
  • Administrator access to your WordPress site

Benefits

Feature Benefit
5GB Free Personal accounts
1TB with M365 Business accounts
Microsoft Integration Part of Office ecosystem
Enterprise Security Compliance features
Real time Collaboration Co-authoring support

Step 1: Create an Azure AD Application

To connect OneDrive, you need to register an application in Microsoft Azure.

1.1 Access Azure Portal

  1. Go to Azure Portal
  2. Sign in with your Microsoft account
  3. If you don’t have an Azure account, you can create one for free

1.2 Register a New Application

  1. In the Azure Portal, search for App registrations in the top search bar
  2. Click App registrations from the results
  3. Click + New registration button

1.3 Configure Application Details

Fill in the registration form:

Name: WPDM OneDrive Integration (any name you like)
Supported account types:
  ○ Single tenant (organization only)
  ● Multi-tenant + personal accounts (recommended)
  ○ Personal Microsoft accounts only

Redirect URI:
  Platform: Web
  URL: https://yoursite.com/onedrive-redirect

Important: Copy the Redirect URI from Downloads > Settings > OneDrive Connect > Azure AD App Configuration . It should look like this: https://yoursite.com/onedrive-redirect

  1. Click Register

1.4 Note Your Application (Client) ID

After registration, you’ll see the app overview page.

  1. Copy the Application (client) ID
  2. Store this ID securely, it will be required for Client ID field

Step 2: Create Client Secret

2.1 Generate Secret

  1. In your Azure app registration, click Manage > Certificates & secrets in the left sidebar
  2. Under Client secrets, click + New client secret
  3. Enter a description (e.g., WPDM OneDrive Secret)
  4. Choose an expiration period:
    • Recommended: 24 months
    • You’ll need to generate a new secret before expiration
  5. Click Add

2.2 Copy Secret Value

Critical: Copy the secret Value immediately! It will only be shown once.

Column What to Copy
Value  Copy this (the actual secret)
Secret ID  Not needed

Store this value securely – you’ll enter it in Client Secret field.


Step 3: Configure API Permissions

3.1 Add Required Permissions

  1. Click API permissions in the left sidebar
  2. Click + Add a permission
  3. Select Microsoft Graph
  4. Select Delegated permissions
  5. Search Files and add these permissions:
Permission Description
Files.Read Read user files
Files.Read.All Read all files user can access
Files.ReadWrite Read write user files
Files.ReadWrite.All Read write all user files
  1. Click Add permissions

3.2 Verify Permissions

Your API permissions should now show:

☑ Files.Read
☑ Files.Read.All
☑ Files.ReadWrite
☑ Files.ReadWrite.All
☑ offline_access
☑ User.Read

Note: Click Grant admin consent (if admin)


Step 4: Configure WordPress Plugin

4.1 Enter Credentials

  1. In WordPress admin, go to Downloads → Settings
  2. Click the OneDrive Connect tab
  3. Enter your credentials:
Field Value
Application (Client) ID Paste the Application ID from Step 1.4
Client Secret Paste the Secret Value from Step 2.2
  1. Click Save Settings

4.2 Connect Your Account

After saving:

  1. Click the Connect with OneDrive button
  2. A popup window will open
  3. Sign in with your Microsoft account
  4. Review the permissions and click Accept
  5. The popup will close automatically
  6. Redirect back to settings page
  7. Refresh the page to see your account details
    ✓ Successfully connected to OneDrive
    Account Name | user@outlook.com
    Token expires: Apr 13, 2030 7:35 AM 

Step 5: Start Using OneDrive Files

5.1 Attach Files to Downloads

  1. Create or edit a Download (Downloads → Add New or Downloads → All Downloads)
  2. In the Attach File section, click Select From OneDrive
  3. Browse your OneDrive folders
  4. Click Attach next to any file
  5. The file will be added to your download package

5.2 Navigation Tips

  • Click folders to navigate into them
  • Use the back button to go up one level
  • The breadcrumb shows your current location
  • File size and modification date are shown for each item

Video Tutorial

Troubleshooting

Connection Failed Error

Possible causes:

  • Incorrect Client ID or Secret
  • Redirect URI mismatch
  • Missing API permissions

Solutions:

  1. Verify Client ID is the Application (client) ID (not Directory ID)
  2. Ensure Redirect URI in Azure exactly matches the one shown in Azure AD App Configuration
  3. Check all required API permissions are added

Access Denied After Login

Possible causes:

  • Missing API permissions
  • Account doesn’t have OneDrive access

Solutions:

  1. Verify all permissions from Step 3 are added
  2. Ensure you’re signing in with an account that has OneDrive

Files Not Loading

Possible causes:

  • Token expired
  • Network issues

Solutions:

  1. Disconnect and reconnect your OneDrive account
  2. Check browser console for error messages
  3. Verify your site can make outbound HTTPS requests

Token Expired Message

The plugin automatically refreshes tokens. If you see this:

  1. Click Disconnect OneDrive
  2. Click Connect with OneDrive again
  3. Re-authorize the application

File Not Found

Causes:

  • File deleted or moved
  • Permission revoked
  • Path changed

Solutions:

  • Verify file exists in OneDrive
  • Check sharing settings
  • Re-attach file

Security Best Practices

Protect Your Credentials

  • Never share your Client Secret publicly
  • Don’t commit credentials to version control
  • Use environment variables for sensitive data in development

Manage Access

  • Regularly review connected applications in your Microsoft account
  • Revoke access for applications you no longer use
  • Set calendar reminders for secret expiration
  • Minimize permissions:
    • Use Files.Read for read-only
    • Use Files.Read.All for shared files
    • Only add write permissions if needed

Revoke Access

To completely disconnect:

  1. In WordPress: Click Disconnect OneDrive in Downloads > Settings > OneDrive Connect > Azure AD App Configuration settings
  2. In Microsoft: Go to account.microsoft.com/privacy
  3. Find Apps and services and revoke access to your app

Azure App Settings Summary

For reference, here are all the Azure AD app settings:

Application Name: WPDM OneDrive (or custom) 
Application Type: Web 
Account Types: Multi-tenant + personal accounts (recommended) 
Redirect URI: https://yoursite.com/onedrive-redirect 
API Permissions (Delegated): 
    - Microsoft Graph: Files.Read 
    - Microsoft Graph: Files.Read.All
    - Microsoft Graph: ReadWrite.All
    - Microsoft Graph: ReadWrite
    - Microsoft Graph: User.Read (optional)
    - Microsoft Graph: offline_access (optional)
Client Secret: [Generated - expires in 24 months]

Personal vs Business

Personal OneDrive

FeatureAvailability
Storage5 GB free, up to 6 TB paid
SharingPublic/specific people
AdminSelf-managed
ComplianceBasic

OneDrive for Business

FeatureAvailability
Storage1 TB – unlimited
SharingOrganization controls
AdminIT managed
ComplianceEnterprise (DLP, eDiscovery)

Tenant Configuration

For business/organization:

Tenant ID: your-org.onmicrosoft.com
   or
Tenant ID: 87654321-dcba-hgfe-lkji-ba0987654321

For personal accounts:

Tenant ID: common
   or
Tenant ID: consumers

Best Practices

  • Use business accounts for enterprise features
  • Regular token refresh – Access periodically
  • Organize files – Clear folder structure
  • Monitor storage – Watch quota usage
  • Backup critical files – Don’t rely solely on OneDrive
  • Review permissions – Audit app access regularly

Related Documentation


Applies to: WordPress Download Manager 7.x + OneDrive Add-on