Mailspring needs to reconnect my Gmail account every time I log in my computer

Description

Mailspring can’t connect with my registered Gmail account. In the accounts tab, the error reads: “Mailspring can no longer authenticate with xanthopoulos.vassilis@gmail.com. The password or authentication may have changed”.

When this error first occurred I tried changing my google password but it didn’t fix things. When I reconnect the account it works fine, but it loses connection as soon as I restart the computer. If I just restart the app the account stays connected though.

Setup

  • OS and Version: Windows 10 Home, version 21H1 (dual boot with Ubuntu 20.04)
  • Installation Method: installer
  • Mailspring Version: 1.9.1-30ef802f

Error Details

Mailspring Version: 1.9.1-30ef802f
Platform: win32
Account State: invalid
Account Provider: gmail
IMAP Server: imap.gmail.com
SMTP Server: smtp.gmail.com

4348 [2021-07-16 13:11:54.818] [metadata] [info] Metadata delta stream starting…
4348 [2021-07-16 13:11:56.831] [background] [info] Fetching XOAuth2 access token (gmail) for 4528b24d
4348 [2021-07-16 13:11:57.172] [background] [critical]


*** Mailspring Sync
*** An exception occurred during program execution:
*** {“debuginfo”:“https://www.googleapis.com/oauth2/v4/token RETURNED {\n “error”: “invalid_grant”,\n “error_description”: “Bad Request”\n}”,“key”:“Invalid Response Code: 400”,“retryable”:false,“what”:“Unknown exception”}


1836 [2021-07-16 13:11:57.911] [main] [info] Identity created at 1587975070 - using ID Schema 1
1836 [2021-07-16 13:11:57.912] [main] [info] ------------- Starting Sync (xanthopoulos.vassilis@gmail.com) ---------------
1836 [2021-07-16 13:11:57.916] [metadata] [info] Metadata delta stream starting…
1836 [2021-07-16 13:11:59.929] [background] [info] Fetching XOAuth2 access token (gmail) for 4528b24d
1836 [2021-07-16 13:12:00.272] [background] [critical]


*** Mailspring Sync
*** An exception occurred during program execution:
*** {“debuginfo”:“https://www.googleapis.com/oauth2/v4/token RETURNED {\n “error”: “invalid_grant”,\n “error_description”: “Bad Request”\n}”,“key”:“Invalid Response Code: 400”,“retryable”:false,“what”:“Unknown exception”}


2076 [2021-07-16 13:12:01.058] [main] [info] Identity created at 1587975070 - using ID Schema 1
2076 [2021-07-16 13:12:01.059] [main] [info] ------------- Starting Sync (xanthopoulos.vassilis@gmail.com) ---------------
2076 [2021-07-16 13:12:01.063] [metadata] [info] Metadata delta stream starting…
2076 [2021-07-16 13:12:03.077] [background] [info] Fetching XOAuth2 access token (gmail) for 4528b24d
2076 [2021-07-16 13:12:03.697] [background] [critical]


*** Mailspring Sync
*** An exception occurred during program execution:
*** {“debuginfo”:“https://www.googleapis.com/oauth2/v4/token RETURNED {\n “error”: “invalid_grant”,\n “error_description”: “Bad Request”\n}”,“key”:“Invalid Response Code: 400”,“retryable”:false,“what”:“Unknown exception”}


9780 [2021-07-16 13:12:04.502] [main] [info] Identity created at 1587975070 - using ID Schema 1
9780 [2021-07-16 13:12:04.503] [main] [info] ------------- Starting Sync (xanthopoulos.vassilis@gmail.com) ---------------
9780 [2021-07-16 13:12:04.510] [metadata] [info] Metadata delta stream starting…
9780 [2021-07-16 13:12:06.507] [background] [info] Fetching XOAuth2 access token (gmail) for 4528b24d
9780 [2021-07-16 13:12:06.856] [background] [critical]


*** Mailspring Sync
*** An exception occurred during program execution:
*** {“debuginfo”:“https://www.googleapis.com/oauth2/v4/token RETURNED {\n “error”: “invalid_grant”,\n “error_description”: “Bad Request”\n}”,“key”:“Invalid Response Code: 400”,“retryable”:false,“what”:“Unknown exception”}


install Mailspring 1.78 and add all acounts then it will get updated to latest version without issues

1 Like

This is really frustrating. I am using Mailspring 1.9.1-30ef802f. I need to open Google in my browser every day to be able to use Mailspring. Is this a known bug, or have I not set something up correctly?

I’m having the same issue, but on outlook account.
I have 2 accounts, one gmail and one outlook. Gmail works normally but I need to re-authenticate with the outlook one on every startup. Which is annoying.
I’ve tried removing and adding the account multiple times, no success.
Seems like the refresh token expires.
2196292 [2021-08-12 10:22:05.805] [background] [info] Fetching XOAuth2 access token (office365) for a16d4d7d
2196292 [2021-08-12 10:22:06.630] [background] [critical]
*** Mailspring Sync
*** An exception occurred during program execution:
*** {“debuginfo”:"Sign in to your account RETURNED {“error”:“invalid_grant”,“error_description”:"AADSTS700081: The refresh token has expired due to maximum lifetime. The token was issued on 2021-08-11T06:30:45.5397290+00:00 and the maximum allowed lifetime for this application is 1.00:00:00.

Came here to report the exact same issue with an Office 365 account. Is mailspring not refreshing the oauth token on time?

Same issue with gsuite account

Experiencing the same issue with a gsuite account here too.

Would be awesome if everyone tracking this issue upvoted this one too since it came first:

My god, finally, thank you for posting the only solution that works.

1 Like

This temporary fix has unfortunately not worked for me.

Try new version has no such issues