Immediate Fix
The fastest way to resolve a “VS Code Login Failed” error on Windows 10 is to clear the stored authentication tokens in the Windows Credential Manager. This forces the application to request a fresh OAuth token.
Follow these steps to reset your login state:
- Close Visual Studio Code completely.
- Open the Start Menu and type “Credential Manager”.
- Select Windows Credentials.
- Locate entries related to
vscode.github-authenticationorvscode.microsoft-authentication. - Click Remove for each of these entries.
- Restart VS Code and attempt to sign in again.
| Error Code/Scenario | Primary Solution |
|---|---|
| Writing login data failed | Run VS Code as Administrator once. |
| Timed out waiting for authentication | Check system proxy settings. |
| Keyring not found | Ensure “Credential Manager” service is running. |
Technical Explanation
VS Code uses the Windows Data Protection API (DPAPI) to store sensitive session tokens. When you log in via GitHub or Microsoft, the application receives an auth token that is passed to the OS keychain for secure storage.
On Windows 10, synchronization issues between the VS Code “Authentication Provider” extension and the SecretStorage API often occur due to corrupted local state files or restrictive permission settings in the %AppData% folder.
If the local encryption key becomes out of sync with your Windows user profile, VS Code will fail to decrypt the stored token, resulting in a persistent “Login Failed” loop even if your password is correct.
[
]
Alternative Methods
1. Use the Command Palette to Sign Out
Sometimes the UI button hangs. Use the internal command to clear the session cache.
# Open Command Palette (Ctrl+Shift+P)
# Type: "Authentication: Sign Out"
# Select the account to remove
2. Disable Settings Sync Temporarily
Settings Sync is a common trigger for login failures. Disabling and re-enabling it can reset the handshake.
- Go to Settings (Gear Icon).
- Select Settings Sync is On.
- Click Turn Off.
- Restart VS Code and turn it back on.
3. Manual Proxy Configuration
If you are behind a corporate firewall, VS Code might fail to reach the authentication endpoint. You can force the application to use your system proxy by launching it with a specific flag:
code --proxy-server="http://yourproxy:8080"