diff --git a/auth/auth.go b/auth/auth.go index 2c2dd15..1cff199 100644 --- a/auth/auth.go +++ b/auth/auth.go @@ -119,14 +119,14 @@ func authenticate(c *protonmail.Client, cachedAuth *CachedAuth, username string) return nil, fmt.Errorf("cannot re-authenticate: failed to get auth info: %v", err) } - if cachedAuth.TwoFactor.Enabled == 1 { - return nil, fmt.Errorf("cannot re-authenticate: two factor authentication enabled, please login manually") - } - auth, err = c.Auth(username, cachedAuth.LoginPassword, authInfo) if err != nil { return nil, fmt.Errorf("cannot re-authenticate: %v", err) } + + if auth.TwoFactor.Enabled == 1 { + return nil, fmt.Errorf("cannot re-authenticate: two factor authentication enabled, please login again manually") + } } else if err != nil { return nil, err }