When you replace your work computer or reset your Microsoft 365 password, OneDrive for Business may stop syncing and display error code 0x8004de40. This error prevents you from signing in to OneDrive even after you enter the correct new password. The problem occurs because OneDrive stores cached credentials and authentication tokens that are no longer valid after a password change or when the account is moved to a new device. This article explains why the 0x8004de40 error appears after a password reset or device swap and provides step-by-step methods to clear the stale credentials and restore syncing.
Key Takeaways: Fixing OneDrive Error 0x8004de40 After Password Reset or Device Replacement
- Windows Credential Manager > Windows Credentials > OneDrive Cached Credentials: Remove all entries related to OneDrive and Microsoft Office to force a fresh authentication request.
- OneDrive Settings > Account > Unlink this PC: Disconnects the current device from your work account so you can sign in again with the new password.
- Registry Editor > HKEY_CURRENT_USER\Software\Microsoft\OneDrive\Accounts: Delete the cached account token subkeys to clear persistent sign-in tokens that survive a password reset.
Why Error 0x8004de40 Occurs After a Password Reset or Device Replacement
The 0x8004de40 error is an authentication failure code. It means OneDrive cannot validate your credentials with the Microsoft 365 authentication service. When you change your password or move your account to a new computer, the cached tokens and credentials stored locally become invalid. OneDrive continues to use the old tokens and fails to negotiate a new sign-in session.
On a device replacement scenario, the new computer may still carry stale cached data from a previous user profile or from an incorrect initial sign-in attempt. If you entered your old password by mistake during the first setup, those bad credentials get cached and block future attempts even after you reset the password.
The error is most common in the following situations:
Password Reset Without Signing Out First
If you reset your Microsoft 365 password from the admin portal or self-service portal while OneDrive is still running with the old password, the cached token becomes invalid immediately. OneDrive does not automatically detect the password change. It keeps trying to use the expired token until the token cache is cleared manually.
Device Replacement with Roaming Credentials
When you set up a new computer and sign in with your work account, Windows may roam cached credentials from a previous device if you use Enterprise State Roaming or a similar sync feature. These stale credentials trigger the 0x8004de40 error on the new device.
Steps to Clear Cached Credentials and Fix Error 0x8004de40
Follow these methods in order. Test syncing after each method before moving to the next.
Method 1: Remove Stored Credentials from Windows Credential Manager
- Open Credential Manager
Press the Windows key and type Credential Manager. Select the result to open the Control Panel applet. - Switch to Windows Credentials
Click Windows Credentials at the top of the window. This section stores cached sign-in tokens for OneDrive and Microsoft Office. - Locate OneDrive and Microsoft Office entries
Look for entries with names such as MicrosoftOffice16_Data:ADAL:…, MicrosoftOffice16_Data:MSOL:…, or OneDrive Cached Credential. They may also contain your account email address. - Remove each entry
Click the arrow next to each entry to expand it, then click Remove. Confirm the deletion when prompted. Remove all entries that contain OneDrive, MicrosoftOffice, or your work email domain. - Restart OneDrive
Right-click the OneDrive cloud icon in the system tray and select Close OneDrive. Then open OneDrive from the Start menu. You will be prompted to sign in again. Enter your new password.
Method 2: Unlink OneDrive from Your Current PC
- Open OneDrive Settings
Right-click the OneDrive cloud icon in the system tray and select Settings from the menu. - Go to the Account tab
In the OneDrive Settings dialog, click the Account tab. - Click Unlink this PC
Under the account section, click Unlink this PC. Confirm the action when asked. This removes the device association from your Microsoft 365 account. - Set up OneDrive again
After unlinking, OneDrive will restart and show the sign-in screen. Enter your work email address and new password. Choose your sync folder location and complete the setup.
Method 3: Delete Cached Account Tokens from the Registry
Use this method if Credential Manager and unlinking do not resolve the error. Incorrect registry edits can cause system instability. Back up the registry before proceeding.
- Open Registry Editor
Press Windows key + R, type regedit, and press Enter. Click Yes if prompted by User Account Control. - Navigate to the OneDrive Accounts key
Go to HKEY_CURRENT_USER\Software\Microsoft\OneDrive\Accounts. This key contains subkeys for each OneDrive account that has been signed in on this device. - Delete the subkey for your work account
Expand the Accounts key. You will see subkeys named with GUIDs. Right-click each subkey and select Delete. Confirm the deletion. If you are unsure which subkey belongs to your work account, delete all subkeys under Accounts. - Close Registry Editor
Exit the Registry Editor. - Restart OneDrive
Right-click the OneDrive system tray icon, select Close OneDrive, and then restart OneDrive from the Start menu. Sign in with your new password.
If OneDrive Still Shows Error 0x8004de40 After the Main Fix
OneDrive Shows 0x8004de40 After Office 365 License Change
If your Microsoft 365 license was reassigned or expired, OneDrive may reject the sign-in even with correct credentials. Verify your license status in the Microsoft 365 admin center by going to Users > Active Users, selecting your account, and checking the Licenses and Apps tab. If the OneDrive license is missing, assign it and wait 15 minutes before trying to sign in again.
Error Persists After Password Reset on a Domain-Joined Device
On computers joined to an on-premises Active Directory domain, cached domain credentials may interfere with OneDrive authentication. Sign out of Windows completely, then sign back in with your new password. After that, open OneDrive and sign in again. This forces Windows to refresh the domain credential cache.
OneDrive for Business Still Fails on a New Device After Unlinking
If you unlinked OneDrive on the old device but the error persists on the new device, the cached credentials may be synced through Windows roaming settings. Disable Enterprise State Roaming temporarily by going to Settings > Accounts > Sync your settings and turning off Sync settings. Then repeat Method 1 on the new device.
Files On-Demand vs Always Keep on This Device: Key Differences
| Item | Files On-Demand | Always Keep on This Device |
|---|---|---|
| Description | Files appear in File Explorer but download only when opened | Files are downloaded and stored locally at all times |
| Disk space usage | Minimal — only metadata is stored locally | Uses full file size on the local drive |
| Offline access | Only files that have been opened recently are available offline | All selected files are available offline |
| Best for | Devices with limited storage or large file libraries | Devices with ample storage and need constant offline access |
After resolving the 0x8004de40 error, you can verify that Files On-Demand is enabled by going to OneDrive Settings > Sync and backup > Advanced settings > Files On-Demand. Toggle the setting to On if it is off. This reduces the initial sync time after reconnecting your account.
Now you can sign in to OneDrive on your new or password-reset device without error 0x8004de40. Next, open the OneDrive sync status icon and confirm that all files show a green checkmark. For persistent issues, run the Microsoft Support and Recovery Assistant for Office 365, which can automate credential cleanup. A final tip: after clearing credentials, always restart the OneDrive process from the system tray rather than just closing the window to ensure the token cache is fully flushed.