After resetting your Microsoft 365 password and then signing in to OneDrive on a new or replaced device, you see error code 0x8004de40. This error prevents OneDrive from connecting to your work account. The issue occurs because the cached credentials on the new device are stale or because the device is still trying to authenticate using the old password. This guide explains why the error happens and provides specific steps to resolve the 0x8004de40 sign-in error so that OneDrive syncs normally again.
Key Takeaways: Fixing 0x8004de40 After Password Reset on a New Device
- Windows Credential Manager > Windows Credentials > OneDrive Cached Credentials: Remove all cached OneDrive tokens to force a fresh authentication request.
- OneDrive Settings > Account > Unlink this PC: Unlink and relink the device to reset the connection with the new password.
- Run OneDriveSetup.exe /reset: Resets the OneDrive sync app without deleting local files, clearing corrupted authentication state.
Why Error 0x8004de40 Occurs After a Password Reset on a Device Replacement
Error 0x8004de40 is a sign-in failure that OneDrive returns when the authentication token stored on the device no longer matches the credentials on the Microsoft Entra ID server. When you reset your Microsoft 365 password, all existing access tokens and refresh tokens for that account become invalid. On a new or replaced device, OneDrive tries to use cached credentials from an earlier setup attempt or from a previous device backup. Because those credentials were created with the old password, the server rejects them and returns error 0x8004de40.
The error can also appear if the device replacement process restored a user profile that still holds outdated Windows credentials. OneDrive for Business relies on the Windows token broker and the Microsoft Authentication Library to obtain tokens. If either component holds a stale token, the sign-in dialog fails silently with 0x8004de40. The fix requires clearing all cached authentication artifacts and establishing a fresh sign-in session.
Steps to Clear Stale Credentials and Fix the 0x8004de40 Error
Follow these steps in order. Each step removes a different layer of cached authentication data. Do not skip steps unless the error resolves earlier.
- Sign out of OneDrive completely
Right-click the OneDrive cloud icon in the system tray. Select Help & Settings > Settings. On the Account tab, click Unlink this PC. Confirm the unlink action. This removes the current device association from your Microsoft 365 account. - Remove cached Windows credentials for OneDrive
Open Control Panel and go to User Accounts > Credential Manager. Click Windows Credentials. Scroll to the Generic Credentials section. Look for entries that contain “OneDrive Cached Credential” or “MicrosoftOffice16_Data:ADAL:”. Also remove any entry that includes your work email address. Click the arrow to expand each entry, then click Remove. Confirm each removal. - Reset the OneDrive sync app
Press Windows key + R to open the Run dialog. Type the following command and press Enter:%localappdata%\Microsoft\OneDrive\onedrive.exe /reset
A command window opens briefly. Wait 30 seconds. If OneDrive does not restart automatically, open the Run dialog again and type:%localappdata%\Microsoft\OneDrive\onedrive.exe
Press Enter. This resets the app’s internal state without deleting your local files. - Clear the Microsoft 365 activation cache
Open a File Explorer window. Paste the following path into the address bar and press Enter:%localappdata%\Microsoft\Office\16.0\Licensing
Delete all files and folders inside the Licensing folder. If a file is in use, close all Office apps and try again. This removes cached activation tokens that might interfere with OneDrive sign-in. - Restart the device and sign in to OneDrive
Restart Windows 11 or Windows 10. After the restart, open OneDrive from the Start menu. Enter your full work email address. On the sign-in page, enter your new password. Complete the additional security prompts if your organization requires multi-factor authentication. OneDrive should now connect without error 0x8004de40. - Verify sync status
Check the OneDrive cloud icon in the system tray. It should show a solid cloud or a green check mark. Open File Explorer, navigate to your OneDrive folder, and confirm that files are syncing. If you still see the error, proceed to the additional fixes in the next section.
If OneDrive Still Shows Error 0x8004de40 After the Main Fix
OneDrive sign-in loops back to the error after entering the new password
This usually means the Windows token broker still holds a cached primary refresh token. Open Credential Manager again. Under Windows Credentials, remove any entry that contains “ADAL” or “MSAL” followed by your tenant name or “login.microsoftonline.com”. Then run the OneDrive reset command again. If the loop continues, temporarily disable your antivirus real-time protection, then retry the sign-in. Some security suites intercept authentication calls and inject stale tokens.
Error 0x8004de40 appears only on Office apps but not in OneDrive itself
Open any Office app such as Word. Go to File > Account > Sign out of all work accounts. Close all Office apps. Open Control Panel > Credential Manager > Windows Credentials. Remove all entries under Generic Credentials that contain “MicrosoftOffice”. Restart the device. Open Word again and sign in with your new password. After Office authenticates, OneDrive should also work.
Multiple user profiles on the device cause persistent errors
If the device replacement restored a user profile from a backup, the profile may contain corrupted credential files. Create a new local user profile on Windows 11 or Windows 10. Sign in to the new profile, install OneDrive, and attempt the sign-in. If the error disappears, migrate your data to the new profile and delete the old one.
OneDrive Sign-in Methods: Fresh Authentication vs Credential Reuse
| Item | Fresh Authentication (Recommended) | Credential Reuse (Causes Error) |
|---|---|---|
| Token source | New token obtained from Microsoft Entra ID after password reset | Stale token from Windows Credential Manager or Office cache |
| Steps required | Unlink OneDrive, clear credentials, reset app, restart | No action taken; user retries sign-in without clearing cache |
| Result | OneDrive connects and syncs normally | Error 0x8004de40 persists |
| When to use | After any password reset or device replacement | Never after a password change |
After completing the steps above, OneDrive for Business should no longer show error 0x8004de40. The key action is clearing all cached credentials from Credential Manager before signing in with the new password. To prevent this error in the future, always unlink OneDrive before resetting your password. If you manage multiple devices, consider using the Microsoft 365 admin center to revoke all stale sessions after a password reset.