From d5a7cf4e0a278475fb5c669c83f6be7c5a760ff8 Mon Sep 17 00:00:00 2001 From: Dmitry Valter Date: Thu, 10 Oct 2019 01:44:01 +0300 Subject: [PATCH] auth/auth: add refresh error 2000 hotfix References: https://github.com/emersion/hydroxide/issues/70 --- auth/auth.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/auth/auth.go b/auth/auth.go index bf6c568..f3744b6 100644 --- a/auth/auth.go +++ b/auth/auth.go @@ -112,7 +112,8 @@ func EncryptAndSave(auth *CachedAuth, username string, secretKey *[32]byte) erro func authenticate(c *protonmail.Client, cachedAuth *CachedAuth, username string) (openpgp.EntityList, error) { auth, err := c.AuthRefresh(&cachedAuth.Auth) - if apiErr, ok := err.(*protonmail.APIError); ok && apiErr.Code == 10013 { + // TODO: error code 2000/2001 'invalid input' happens since 09.2019 + if apiErr, ok := err.(*protonmail.APIError); ok && (apiErr.Code == 10013 || apiErr.Code == 2000 || apiErr.Code == 2001) { // Invalid refresh token, re-authenticate authInfo, err := c.AuthInfo(username) if err != nil {