WPDM OneDrive Integration
Complete setup instructions for connecting Microsoft OneDrive to WordPress Download Manager.
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
Step 1: Create an Azure AD Application
To connect OneDrive, you need to register an application in Microsoft Azure.
1.1 Access Azure Portal
- Go to Azure Portal
- Sign in with your Microsoft account
- If you don’t have an Azure account, you can create one for free
1.2 Register a New Application
- In the Azure Portal, search for “App registrations” in the top search bar
- Click “App registrations” from the results
- Click “+ New registration” button
1.3 Configure Application Details
Fill in the registration form:
| Field | Value |
|---|---|
| Name | WPDM OneDrive (or any name you prefer) |
| Supported account types | Select “Accounts in any organizational directory and personal Microsoft accounts” |
| Redirect URI | Select “Web” from dropdown |
Important: Leave the Redirect URI field empty for now. We’ll add it in the next step.
- Click “Register”
1.4 Note Your Application (Client) ID
After registration, you’ll see the app overview page.
- Copy the “Application (client) ID” – you’ll need this later
- Keep this page open
Step 2: Configure Redirect URI
2.1 Get Redirect URI from WordPress
- In WordPress admin, go to Downloads → Settings
- Click the “OneDrive Connect” tab
- Find the “Redirect URI” field
- Copy the URL (it should look like:
https://yoursite.com/onedrive-redirect)
2.2 Add Redirect URI in Azure
- Back in Azure Portal, in your app registration
- Click “Authentication” in the left sidebar
- Under “Platform configurations”, click “+ Add a platform”
- Select “Web”
- Paste your Redirect URI in the “Redirect URIs” field
- Leave other options as default
- Click “Configure”
Step 3: Create Client Secret
3.1 Generate Secret
- In your Azure app registration, click “Certificates & secrets” in the left sidebar
- Under “Client secrets”, click “+ New client secret”
- Enter a description (e.g.,
WPDM OneDrive Secret) - Choose an expiration period:
- Recommended: 24 months
- You’ll need to generate a new secret before expiration
- Click “Add”
3.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 WordPress.
Step 4: Configure API Permissions
4.1 Add Required Permissions
- Click “API permissions” in the left sidebar
- Click “+ Add a permission”
- Select “Microsoft Graph”
- Select “Delegated permissions”
- Search and add these permissions:
| Permission | Description |
|---|---|
Files.Read |
Read user files |
Files.Read.All |
Read all files user can access |
User.Read |
Read user profile |
offline_access |
Maintain access (for refresh tokens) |
- Click “Add permissions”
4.2 Verify Permissions
Your API permissions should now show:
Microsoft Graph (4)
├── Files.Read Delegated
├── Files.Read.All Delegated
├── User.Read Delegated
└── offline_access Delegated
Note: Admin consent is NOT required for these delegated permissions.
Step 5: Configure WordPress Plugin
5.1 Enter Credentials
- In WordPress admin, go to Downloads → Settings
- Click the “OneDrive Connect” tab
- Enter your credentials:
| Field | Value |
|---|---|
| Application (Client) ID | Paste the Application ID from Step 1.4 |
| Client Secret | Paste the Secret Value from Step 3.2 |
- Click “Save Changes”
5.2 Connect Your Account
After saving:
- Click the “Connect with OneDrive” button
- A popup window will open
- Sign in with your Microsoft account
- Review the permissions and click “Accept”
- The popup will close automatically
- You should see “Connected successfully!” message
- Refresh the page to see your account details
Step 6: Start Using OneDrive Files
6.1 Attach Files to Downloads
- Create or edit a Download (Downloads → Add New or Downloads → All Downloads)
- In the “Attach File” section, click “Select From OneDrive”
- Browse your OneDrive folders
- Click “Attach” next to any file
- The file will be added to your download package
6.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
Troubleshooting
“Connection Failed” Error
Possible causes:
- Incorrect Client ID or Secret
- Redirect URI mismatch
- Missing API permissions
Solutions:
- Verify Client ID is the “Application (client) ID” (not Directory ID)
- Ensure Redirect URI in Azure exactly matches the one shown in WordPress
- Check all required API permissions are added
“Access Denied” After Login
Possible causes:
- Missing API permissions
- Account doesn’t have OneDrive access
Solutions:
- Verify all permissions from Step 4 are added
- Ensure you’re signing in with an account that has OneDrive
Files Not Loading
Possible causes:
- Token expired
- Network issues
Solutions:
- Disconnect and reconnect your OneDrive account
- Check browser console for error messages
- Verify your site can make outbound HTTPS requests
“Token Expired” Message
The plugin automatically refreshes tokens. If you see this:
- Click “Disconnect OneDrive”
- Click “Connect with OneDrive” again
- Re-authorize the application
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
Revoke Access
To completely disconnect:
- In WordPress: Click “Disconnect OneDrive” in settings
- In Microsoft: Go to account.microsoft.com/privacy
- 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: Personal + Organizational
Redirect URI: https://yoursite.com/onedrive-redirect
API Permissions (Delegated):
- Microsoft Graph: Files.Read
- Microsoft Graph: Files.Read.All
- Microsoft Graph: User.Read
- Microsoft Graph: offline_access
Client Secret: [Generated - expires in 24 months]
Getting Help
If you encounter issues:
- Check the WPDM Documentation
- Visit the Support Forum
- Ensure you’re using the latest plugin version
Changelog
Version 2.0.0
- Initial release
- Microsoft OAuth 2.0 integration
- OneDrive file browser
- One-click file attachment
- Personal and Business account support
- Automatic token refresh