Gmail account de-authenticates after each restart

Description

I have a Gmail account linked to Mailspring. After authenticating the account, everything works as expected, however, if I restart Mailspring (or my computer), I get an error that Mailspring cannot authenticate with my email. After I reconnect/reauthenticate, everything works as expected.

Here are the connection logs from Mailspring:

Mailspring Version: 1.9.2-6e14dad1
Platform: win32
Account State: invalid
Account Provider: gmail
IMAP Server: imap.gmail.com
SMTP Server: smtp.gmail.com
--------------------------------------------
14276 [2021-09-25 09:43:04.460] [metadata] [info] Metadata sync disabled, not logged in.
14276 [2021-09-25 09:43:08.471] [background] [info] Fetching XOAuth2 access token (gmail) for 9a26c44d
14276 [2021-09-25 09:43:08.711] [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"}
***

1780 [2021-09-25 09:43:09.515] [main] [info] Identity created at 1632580989 - using ID Schema 1
1780 [2021-09-25 09:43:09.516] [main] [info] ------------- Starting Sync (XXXXXXXXX@gmail.com) ---------------
1780 [2021-09-25 09:43:09.520] [metadata] [info] Metadata sync disabled, not logged in.
1780 [2021-09-25 09:43:13.528] [background] [info] Fetching XOAuth2 access token (gmail) for 9a26c44d
1780 [2021-09-25 09:43:13.760] [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"}
***

13952 [2021-09-25 09:43:14.454] [main] [info] Identity created at 1632580994 - using ID Schema 1
13952 [2021-09-25 09:43:14.455] [main] [info] ------------- Starting Sync (XXXXXXXXX@gmail.com) ---------------
13952 [2021-09-25 09:43:14.458] [metadata] [info] Metadata sync disabled, not logged in.
13952 [2021-09-25 09:43:18.472] [background] [info] Fetching XOAuth2 access token (gmail) for 9a26c44d
13952 [2021-09-25 09:43:18.702] [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"}
***

1748 [2021-09-25 09:43:19.400] [main] [info] Identity created at 1632580999 - using ID Schema 1
1748 [2021-09-25 09:43:19.401] [main] [info] ------------- Starting Sync (XXXXXXXXX@gmail.com) ---------------
1748 [2021-09-25 09:43:19.405] [metadata] [info] Metadata sync disabled, not logged in.
1748 [2021-09-25 09:43:23.405] [background] [info] Fetching XOAuth2 access token (gmail) for 9a26c44d
1748 [2021-09-25 09:43:23.648] [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"}
***

This has been reported several times before so there’s clearly an issue here. I’d suggest you add your details to and upvote the first report thread here and close this one, so everything’s together for the devs.