Fixing the Gmail OAuth Loop in Outlook After Migrating to Microsoft 365

After migrating your company from Google Workspace to Microsoft 365, are your users stuck with a never-ending Gmail login prompt in Outlook? Even after you remove the account, the ghost of Google remains. This guide provides a definitive, beginner-friendly solution to completely purge the old Gmail account and restore sanity to Outlook.

🧠 The Problem: An Unstoppable Login Prompt

  • ❌ Symptom: Outlook keeps opening the Gmail login popup repeatedly, even after the Gmail account has been removed from Outlook.
  • βœ… Goal: To permanently remove all traces of the old Gmail account and stop Outlook from trying to connect to Google.

πŸ’‘ Root Cause: Microsoft Store App vs. Desktop App

The core of this issue lies in the Microsoft Store version of Outlook (often pre-installed on Windows). It behaves differently than the full Microsoft 365 desktop app by integrating too deeply with Windows, causing:

  • Aggressive Auto-Linking: It uses the Windows Web Account Manager to automatically link accounts, bypassing traditional Outlook profiles.
  • Persistent Login Tokens: It stores Gmail login tokens at the Windows level, not just in Outlook. When you remove the account, the token remains, and Windows keeps trying to use it.

Outlook App Comparison: Why the Version Matters

Feature Outlook (Microsoft Store App) Outlook (Microsoft 365 Desktop App)
Account Management Integrates with Windows Accounts (Problematic) Self-contained via Control Panel (Reliable)
Authentication Tokens Stored deeply in Windows, hard to remove Stored manageably in Credential Manager
Prevalence of OAuth Loop High. This is the primary cause. Low. Behaves as expected.

πŸ› οΈ The Step-by-Step Fix: A Full System Cleanup

Follow these steps precisely. This process cleans up only Outlook settings on your computer; your emails on the server are safe.

βœ… Step 1: Delete All Outlook Profiles

First, we remove all stored account configurations from the Mail Setup utility.

How to Open the Run Command: Press the Windows Key + R on your keyboard. A small window will pop up in the corner of your screen.
  1. Open the Run command (Windows Key + R).
  2. Type the following command and press Enter:
Run Command
control mlcfg32.cpl
  1. In the "Mail Setup" window that appears, click on Show Profiles...
  2. Select each profile in the list and click Remove until the list is empty. Confirm any warnings.

βœ… Step 2: Delete Stored Google Credentials

This is the most critical step. We will manually delete the hidden login tokens.

  1. Open the Run command again (Windows Key + R).
  2. Type cmdkey /list and press Enter. This will open a black window (Command Prompt) listing all your saved credentials.

Look through the list for any entry that contains `google` or is a `MicrosoftAccount` with your old Gmail address. To delete one, you'll need its "Target" name. Copy the full target name and use it in the delete command.

Command Prompt / PowerShell
# First, list them to find the target name:
cmdkey /list

# Then, delete the specific ones you found (yours might be different):
cmdkey /delete:MicrosoftOffice16_Data:OAUTH2:112053071490276812316_tp_google_imap_OAuth2
cmdkey /delete:MicrosoftAccount:[email protected]

βœ… Step 3: Delete Outlook's Local Cache

Next, we clear out local data files (.ost files) that can cause issues.

  1. Open the Run command (Windows Key + R).
  2. Type the following path and press Enter. This will open a File Explorer window directly to the right folder.
Run Command / File Explorer Path
%localappdata%\Microsoft\Outlook
  1. Inside that folder, select all files and folders (Ctrl + A).
  2. Permanently delete them by pressing Shift + Delete.

βœ… Step 4: Uninstall the Microsoft Store Version of Outlook

Important: This step requires Administrator rights. Follow these instructions carefully.
  1. Press the Windows Key on your keyboard to open the Start Menu.
  2. Type PowerShell.
  3. You will see "Windows PowerShell" in the search results. Right-click on it and choose Run as administrator.
  4. A blue window will open. Copy and paste the command below, then press Enter.
Administrator PowerShell
Get-AppxPackage *outlook* | Remove-AppxPackage

If you see red error text, it likely means the app was already gone. You can safely continue.

Stuck or Need an Expert?

This process can be tricky. If you're not comfortable or the issue persists, professional help can solve it in minutes.

πŸš€ Get Remote Support

For direct assistance, contact a specialist via WhatsApp.

πŸš€ Final Step: Install the Proper Outlook Desktop App

With the system fully cleaned, install the correct version of Outlook from your Microsoft 365 subscription.

  1. Go to portal.office.com and sign in with your new Microsoft 365 account.
  2. Look for a button that says Install and more or Install apps (usually on the top right).
  3. Select Install Microsoft 365 apps to download the installer.
  4. Run the installer and follow the prompts. Once finished, open the new Outlook and add your Microsoft 365 account. The Gmail prompt will be gone for good.

❓ Frequently Asked Questions (FAQ)

Q: Will this delete my actual emails on the server?

No. This entire process only affects data stored locally on your computer (cache, settings, login tokens). All your emails are safe on the Microsoft 365 and Google servers. When you set up the new Outlook, it will download a fresh copy of your mail.

Q: The command `control mlcfg32.cpl` gives an error or does nothing. Why?

This can happen if you have a 64-bit version of Office on a 64-bit Windows system, or if Office wasn't installed correctly. Don't worry, you can access the same setting through the Control Panel. Go to Control Panel > User Accounts > Mail (Microsoft Outlook).

Q: I ran `cmdkey /list` but I'm scared to delete the wrong thing. What should I look for?

You are only looking for entries that specifically mention `google` or `MicrosoftAccount:user=` followed by your old `@gmail.com` or Google Workspace email address. It's safe to delete these. Avoid deleting anything that looks like a Windows system credential (e.g., `LegacyGeneric`).

Q: Can I still add a personal Gmail account to Outlook later?

Yes, absolutely. After fixing the issue and setting up your main Microsoft 365 account, you can add a Gmail account. For best results, use Gmail's "App Password" feature. Enable 2-Step Verification in your Google account, generate a 16-digit App Password, and use that password when adding the account to Outlook instead of your main password.

Q: I've tried everything and I'm still stuck. What are my options?

If the loop persists, there might be a deeper registry issue or a conflicting policy. At this point, expert help is recommended to diagnose the root cause safely. Our remote support service is designed for these complex cases. Click here for fast remote assistance.

For more technical guides and enterprise IT solutions, visit our main site.

πŸ‘‰ Learn More at NetTech Infosys

Trusted by some of the biggest brands

We’re Waiting To Help You

Get in touch with us today and let’s start transforming your business from the ground up.