The OneDrive for Business sign-in error 0x8004de40 prevents users from connecting to their cloud storage. The error message appears when you try to sign in to OneDrive, and it keeps returning even after you enter your credentials multiple times. This error typically indicates a problem with the authentication token or a conflict between cached credentials and the Microsoft 365 authentication service. This article explains the root cause of the 0x8004de40 error and provides step-by-step fixes that resolve the issue permanently, including methods for clearing stored tokens, resetting the OneDrive app, and repairing Office installation.
Key Takeaways: Fixing OneDrive Error 0x8004de40
- Windows Credential Manager > Windows Credentials > OneDrive Cached Credentials: Removing these stored tokens forces OneDrive to request fresh authentication from Microsoft 365.
- OneDrive Settings > Account > Unlink this PC: Resetting the sync relationship clears corrupted local state that triggers the repeated sign-in prompt.
- Run the Microsoft Support and Recovery Assistant (SaRA): This automated tool detects and repairs Office sign-in issues, including the 0x8004de40 error, without manual registry editing.
Why OneDrive Error 0x8004de40 Keeps Returning
The 0x8004de40 error is a sign-in failure that occurs when the OneDrive desktop app cannot validate your credentials with the Microsoft 365 authentication service. The error code maps to a token expiration or corruption issue. When you sign in, OneDrive sends a cached authentication token to Azure Active Directory. If that token is expired, malformed, or tied to a previous user session, the server rejects it and returns error 0x8004de40. The app then shows the sign-in dialog again, creating a loop.
Several factors cause the token to become invalid:
- Password change on the Microsoft 365 account without signing out of OneDrive first.
- Multiple user profiles on the same Windows device where a different Microsoft 365 account was previously signed in.
- Corrupted Office credential cache after an update or repair of Microsoft 365 Apps.
- Network proxy or firewall that blocks authentication endpoints used by OneDrive.
Because the error originates from a stale token, simply clicking Sign In again does not resolve it. You must clear the cached credentials and force a fresh authentication flow.
Steps to Clear Cached Credentials and Fix the Sign-In Loop
Follow these steps in order. Test OneDrive sign-in after each method. If the error persists, move to the next step.
- Open Windows Credential Manager
Press the Windows key and type Credential Manager. Click the result to open the control panel. Select Windows Credentials from the top bar. - Remove OneDrive and Office cached credentials
In the Generic Credentials section, look for entries that contain OneDrive Cached Credential or MicrosoftOffice16_Data:ADAL: followed by a GUID. Click the arrow to expand each entry, then select Remove. Confirm the removal. Repeat for all entries that reference OneDrive, MicrosoftOffice, or ADAL. - Close Credential Manager and restart OneDrive
Right-click the OneDrive cloud icon in the system tray and select Quit OneDrive. Wait 10 seconds. Open OneDrive from the Start menu. You will be prompted to sign in again. Enter your Microsoft 365 credentials. - If error persists, unlink OneDrive from your PC
Right-click the OneDrive icon and select Settings. Go to the Account tab and click Unlink this PC. Confirm the action. OneDrive will close. Open OneDrive again and sign in with your work or school account. - Run the Microsoft Support and Recovery Assistant
Download SaRA from the Microsoft 365 admin center or the official Microsoft download site. Open the tool and select Office > I’m having trouble signing in to Office. Follow the on-screen prompts. SaRA will check for token issues, proxy conflicts, and account configuration errors. It will apply fixes automatically if detected. - Reset OneDrive sync completely
Press Windows + R, type %localappdata%\Microsoft\OneDrive\onedrive.exe /reset, and press Enter. A command prompt window appears briefly. Wait 2 minutes. If OneDrive does not restart automatically, open it from the Start menu. This reset clears all cached data and reinitializes the sync engine.
If OneDrive Still Shows the 0x8004de40 Error After the Main Fix
Some environments require additional steps because the error persists due to deeper system or network issues.
OneDrive error 0x8004de40 after password change
When you change your Microsoft 365 password, OneDrive does not automatically update the stored token. The old token becomes invalid, causing the sign-in loop. In addition to clearing credentials from Credential Manager, sign out of all Office apps. Open any Office app like Word, click File > Account > Sign Out. Then sign back in with the new password. This forces the Office suite to refresh its authentication cache alongside OneDrive.
Error 0x8004de40 on a shared or domain-joined computer
On corporate devices, Group Policy may enforce proxy settings or block the endpoints that OneDrive uses for authentication. The required URLs include login.microsoftonline.com and all subdomains, accounts.accesscontrol.windows.net, and wns.windows.com. Contact your IT administrator to verify that these endpoints are allowed through the firewall and proxy. If the device uses a proxy with authentication, add onedrive.com and all subdomains to the proxy bypass list.
Error 0x8004de40 reappears after a Windows update
Windows updates sometimes reset the credential cache or modify the registry keys used by OneDrive. Reapply the credential removal steps. If the error continues, repair Microsoft 365 Apps. Open Settings > Apps > Installed apps, find Microsoft 365 Apps or Microsoft Office, click the three dots, and select Modify. Choose Quick Repair and follow the prompts. A Quick Repair replaces corrupted Office files without affecting your data.
Manual Credential Removal vs SaRA Automated Fix: Key Differences
| Item | Manual Credential Removal | SaRA Automated Fix |
|---|---|---|
| Time required | 5-10 minutes | 10-20 minutes |
| User skill level | Intermediate: requires navigating Credential Manager and identifying correct entries | Beginner: guided wizard with no manual selection |
| Scope of fix | Removes only credentials you manually select | Scans for token corruption, proxy misconfiguration, and account issues |
| Risk of removing wrong entry | Yes: deleting unrelated credentials can affect other apps | No: tool targets only Office and OneDrive related items |
| Requires admin rights | Yes, to access Credential Manager | Yes, to install and run the tool |
For most users, starting with manual credential removal is faster. If the error returns within 24 hours, run SaRA to detect underlying issues that manual steps miss.
You can now clear the OneDrive 0x8004de40 error by removing cached credentials in Credential Manager or unlinking your PC. If the error reappears, run the Microsoft Support and Recovery Assistant to check for broader authentication problems. As an advanced step, use the /reset switch on the OneDrive executable to fully reinitialize the sync engine without reinstalling the app. This ensures that no corrupted local state remains to trigger the sign-in loop again.