Outlook OAuth reconnect loop – invalid_grant persists after successful login until app restart

Description

Issue:
Outlook/Hotmail account was working and then just starts failing to re-authenticate with error:
“Cannot authenticate” error requesting to Check Again/Reconnect.

Check again accomplishes nothing.

Reconnect flow:

  • Browser login completes successfully
  • Microsoft shows “You’re all set!”
  • Mailspring reconnect dialog then reports:
    “Sorry, we had trouble logging you in. A network error occurred”

Error Details show:
invalid_grant / AADSTS70000 (expired grant)

Key Problem:
Even after successful OAuth login, Mailspring does NOT replace the expired grant.
It continues trying to use the old token and fails.

Workaround:

  1. Revoke Mailspring access here from Microsoft account
  2. Reconnect again, re-granting Mailspring App permissions on Microsoft account
  3. Mailspring still fails to use the new grant
  4. Fully restart Mailspring (pkill mailspring)
  5. Reconnect again, then starts working as expected

Only after hard Mailspring restart and reconnect does Mailspring accept the new grant and authenticate successfully.

Expected and Actual Behavior:
After successful OAuth login, Mailspring should replace the expired grant immediately without requiring removing Mailspring app access in Microsoft account, pkilling the application, restarting and then Reconnecting again for it to finally take.

Notes:

  • Network is functioning normally
  • Issue reproducible across multiple reconnect attempts without restart

To Reproduce…

Steps to reproduce the behavior: See above.

Setup

  • Mailspring Version: 1.19.0
  • Platform: Linux (Kubuntu 24.04 LTS)