Skip to content

Commit

Permalink
auth: fix re-auth 2FA error message not showing up
Browse files Browse the repository at this point in the history
There was a confusing error message instead:

    [403] Access token does not have sufficient scope

Which just meant the access token was used without completing 2FA.
  • Loading branch information
emersion committed Nov 23, 2021
1 parent 9aeff31 commit fd518b5
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions auth/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit fd518b5

Please sign in to comment.