Vs Code Clear Authentication Cache [Solved]

Symptoms & Diagnosis

VS Code login failures often manifest as an infinite loop of authentication prompts or the “Sign in failed” error message. This typically happens when stored tokens for GitHub or Microsoft accounts become corrupted or expire without being properly refreshed.

You might notice that even after entering the correct credentials in your browser, VS Code fails to acknowledge the success. This mismatch between the local credential store and the remote provider is a clear sign that the authentication cache needs a manual reset.

Other symptoms include extensions like GitHub Copilot or Live Share failing to initialize. In these cases, the internal keychain service within VS Code is usually holding onto a stale session ID that prevents a fresh handshake with the server.

Visual guide on how to clear VS Code authentication cache for login issues.

Troubleshooting Guide

The most effective way to resolve authentication issues is to clear the internal cache and the OS-level credential store. Start by logging out through the VS Code UI before moving to more aggressive manual deletions.

Method 1: Sign Out via Account Menu

Click on the Accounts icon in the bottom left of the Activity Bar. Select the account causing issues and click Sign Out. This triggers a basic cleanup of the session tokens.

Method 2: Clear OS Credential Store

If the UI logout doesn’t work, you must manually remove the credentials from your operating system’s manager. Use the following table to locate the correct entries for your environment.

Operating System Credential Location Target Name to Delete
Windows Credential Manager > Windows Credentials vscodejsauth / vscode.github-authentication
macOS Keychain Access vscode-code / GitHub / Microsoft
Linux libsecret / Secret Service vscode-authentication

Method 3: Resetting via Command Palette

Open the Command Palette (Ctrl+Shift+P or Cmd+Shift+P) and search for the following command to reset your local session data. This forces the application to re-initialize its security storage.

Developer: Clear Keyboard Shortcuts Cache
Developer: Reload Window

For GitHub specific issues, you can also run the following command in your terminal to verify the status of your authenticated hosts if you use the GitHub CLI alongside VS Code:

gh auth status

Prevention

To prevent future authentication failures, ensure that VS Code is always updated to the latest version. Developers often face issues when the IDE’s internal security protocols fall out of sync with the web provider’s updated OAuth requirements.

Avoid using multiple versions of VS Code (like Insiders and Stable) with the same account simultaneously on one machine. This can cause “race conditions” where one instance invalidates the token used by the other.

Lastly, if you use a proxy or a VPN, ensure that the authentication endpoints for github.com and microsoftonline.com are whitelisted. Network interruptions during the token exchange process are a leading cause of cache corruption.