How to Permanently Fix the Gmail OAuth Login Loop in Outlook After Microsoft 365 Migration
After migrating your company from Google Workspace to Microsoft 365, are your users stuck in a frustrating, never-ending Gmail login prompt in Outlook? Even after you remove the account, the ghost of Google remains, constantly asking for a password. This guide provides a definitive, beginner-friendly solution to completely purge the old Gmail account, perform a clean install of the correct Outlook app, and restore sanity to your workflow.
The Core Problem: An Unstoppable Login Prompt
❌ Symptom: Outlook keeps opening the Gmail login popup repeatedly, even after the Gmail account has been removed from Outlook profiles and settings.
✅ Goal: To permanently remove all traces of the old Gmail account and stop Outlook from trying to connect to Google, ensuring a stable Microsoft 365 experience.
Root Cause: Microsoft Store App vs. Full Desktop App
The core of this issue lies in the Microsoft Store version of Outlook (often pre-installed on Windows). It behaves very differently from the full Microsoft 365 desktop app by integrating too deeply with the Windows operating system.
- Aggressive Auto-Linking: It uses the Windows Web Account Manager to automatically link accounts, bypassing traditional Outlook profiles.
- Persistent Login Tokens: It stores Gmail OAuth login tokens at the Windows level, not just in Outlook. When you remove the account from Outlook, the token remains, and Windows relentlessly keeps trying to use it, creating the authentication loop.
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 Mail 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 Definitive Step-by-Step Fix: A Full System Cleanup
Follow these steps precisely to perform a complete cleanup and resolve the issue for good.
Step 1: Delete All Outlook Profiles
First, we remove all stored account configurations from the old Mail Setup utility. This ensures we start with a blank slate.
Press the Windows Key + R on your keyboard to open the "Run" command box. Type the following command and press Enter.
control mlcfg32.cpl
- In the "Mail Setup" window that appears, click on Show Profiles...
- Select each profile in the list one by one and click Remove.
- Continue until the list is empty. Confirm any warnings that appear.
Note: If the command doesn't work, go to Control Panel > User Accounts > Mail (Microsoft Outlook).
Step 2: Delete Stored Google & Outlook Credentials
This is the most critical step. We will manually delete the hidden login tokens that Windows has stored, which are the root cause of the loop.
Press Windows Key + R, type
cmd
, and press Enter to open the Command Prompt. You can run the commands below in this window or in PowerShell.
- First, list all saved credentials to find the ones we need to delete. Copy and paste this command:
- Look through the list for any entry where the "Target" contains
google
,OAUTH2
, or is aMicrosoftAccount:user=
followed by your old Gmail or Google Workspace email address. - To delete a credential, use the
/delete
command with the exact "Target" name you found. Here are some common examples (yours will be different):
cmdkey /list
# Copy the full Target name from the list and use it like this:
cmdkey /delete:MicrosoftOffice16_Data:OAUTH2:112053071490276812316_tp_google_imap_OAuth2
cmdkey /delete:MicrosoftAccount:[email protected]
cmdkey /delete:MicrosoftAccount:[email protected]
Delete every credential related to the old Google account.
Step 3: Clear Outlook's Local Cache Files
Next, we clear out local data files (.ost
files) that can retain old account information and cause conflicts.
Press Windows Key + R, paste the following path, and press Enter. This will open File Explorer directly to the right folder.
%localappdata%\Microsoft\Outlook
- Once the folder is open, select all files and folders inside (press Ctrl + A).
- Permanently delete them by pressing Shift + Delete. This bypasses the Recycle Bin.
Step 4: Uninstall the Problematic Microsoft Store Outlook
Now we remove the app that caused the issue in the first place.
1. Press the Windows Key to open the Start Menu.
2. Type PowerShell.
3. In the search results, right-click on "Windows PowerShell" and select Run as administrator.
4. A blue window will appear. You are now ready to run administrative commands.
Copy and paste the following command into the blue PowerShell window and press Enter:
Get-AppxPackage *outlook* | Remove-AppxPackage
If you see red error text, it likely means the Store app was not installed. You can safely ignore it and continue.
🚀 Get Instant Remote Support via WhatsApp
Step 5: Install the Full Microsoft 365 Outlook Desktop App
With the system fully cleaned, it's time to install the correct, reliable version of Outlook from your Microsoft 365 subscription.
- Go to portal.office.com and sign in with your new Microsoft 365 account.
- On the top right of the page, look for a button that says Install and more or Install apps.
- Select Install Microsoft 365 apps from the dropdown to download the official installer.
- Run the downloaded installer and follow the on-screen prompts.
Once finished, open the new Outlook. It will prompt you to set up your account. Use your Microsoft 365 credentials, and the Gmail login loop will be gone for good.
Step 6 (Optional): Create a Start Menu Shortcut
If the new Outlook doesn't automatically appear in your Start Menu, you can create a shortcut manually using PowerShell (run as administrator).
$WScriptShell = New-Object -ComObject WScript.Shell
$Shortcut = $WScriptShell.CreateShortcut("$env:APPDATA\Microsoft\Windows\Start Menu\Programs\Outlook.lnk")
$Shortcut.TargetPath = "C:\Program Files\Microsoft Office\root\Office16\OUTLOOK.EXE"
$Shortcut.Save()
Advanced Method: Install Only Outlook with the Office Deployment Tool
For IT professionals or advanced users who want to install only Outlook without the rest of the Office suite, the Office Deployment Tool (ODT) is the perfect solution.
- Download the ODT from the official Microsoft website and extract it to a simple folder, like
C:\ODT
. - Create a Configuration File: In the same folder, create a new text file named
install_outlook.xml
and paste the following content into it:
- Run the Installation: Open PowerShell as an administrator and navigate to your ODT folder. Then run the setup command.
The command
cd C:\ODT
tells PowerShell to "change its current working directory" to the C:\ODT
folder. This is necessary so it can find the setup.exe
and install_outlook.xml
files you created.
# Change directory to your ODT folder
cd C:\ODT
# Start the configuration
.\setup.exe /configure install_outlook.xml
This will silently install only the Outlook desktop app in the background.
Frequently Asked Questions (FAQ)
Q: Will this process delete my actual emails on the server?
A: No. Absolutely not. 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?
A: This can happen on some versions of Windows or Office. Don't worry, there's a simple alternative. Open the classic Control Panel, change the "View by" option to "Small icons," and look for an icon named Mail (Microsoft Outlook). Clicking this will open the exact same "Mail Setup" window.
Q: I ran `cmdkey /list` but I'm scared to delete the wrong thing. What should I look for?
A: It's smart to be cautious! You are only looking for entries where the Target specifically mentions google
, references your old @gmail.com
address, or says MicrosoftOffice16_Data:OAUTH2
. It is safe to delete these. Avoid deleting anything that looks like a Windows system credential (e.g., `LegacyGeneric` or anything related to `WindowsUser`). When in doubt, only delete entries you are certain are linked to Google or your old account.
Q: Why can't I just create a new Outlook profile to fix this?
A: Because the problem isn't in the Outlook profile itself. The problematic Gmail authentication token is saved at the Windows operating system level by the Microsoft Store app. New Outlook profiles will still see and attempt to use this persistent token, which is why a deeper cleanup of the Windows Credential Manager (`cmdkey`) and removal of the Store app is necessary.
Q: Can I still add a personal Gmail account to my clean Outlook installation later?
A: Yes, absolutely. After fixing the issue and setting up your main Microsoft 365 account, you can add a Gmail account without issue. For best results, use Gmail's "App Password" feature.
1. Enable 2-Step Verification in your Google account settings.
2. Go to the "App Passwords" section and generate a new 16-digit password for Outlook.
3. When adding the Gmail account to Outlook, use this App Password instead of your regular Google password. This method is more secure and reliable.
Q: I've tried everything and I'm still stuck in the Gmail login loop. What now?
A: If the loop persists after following every step, there might be a deeper issue, such as a conflicting company policy (GPO), a registry corruption, or a third-party application interfering. At this point, expert help is recommended to diagnose the root cause safely and avoid potential data loss. Our remote support service is designed for these complex cases.
For more tech guides or to get professional assistance, visit our website.
👉 Learn More at Nettech Infosys