Skip to content

Commit

Permalink
auth/auth: add refresh error 2000 hotfix
Browse files Browse the repository at this point in the history
References: #70
  • Loading branch information
dvalter authored and emersion committed Nov 14, 2019
1 parent 40cadc8 commit d5a7cf4
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion auth/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit d5a7cf4

Please sign in to comment.