Skip to content

Commit d5a7cf4

Browse files
dvalteremersion
authored andcommitted
auth/auth: add refresh error 2000 hotfix
References: #70
1 parent 40cadc8 commit d5a7cf4

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

auth/auth.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,8 @@ func EncryptAndSave(auth *CachedAuth, username string, secretKey *[32]byte) erro
112112

113113
func authenticate(c *protonmail.Client, cachedAuth *CachedAuth, username string) (openpgp.EntityList, error) {
114114
auth, err := c.AuthRefresh(&cachedAuth.Auth)
115-
if apiErr, ok := err.(*protonmail.APIError); ok && apiErr.Code == 10013 {
115+
// TODO: error code 2000/2001 'invalid input' happens since 09.2019
116+
if apiErr, ok := err.(*protonmail.APIError); ok && (apiErr.Code == 10013 || apiErr.Code == 2000 || apiErr.Code == 2001) {
116117
// Invalid refresh token, re-authenticate
117118
authInfo, err := c.AuthInfo(username)
118119
if err != nil {

0 commit comments

Comments
 (0)