When logging in with the latest versions, you may receive an invalid username or password error even though it is correct.
With the new SRP ceremonial it requires the client to send a salt and a precomputed password verifier value to the server. The server must store these values to later authenticate the client.
If your password is very old (pre SRP), it is likely that Apple servers did not receive these values for your password, hence can not authenticate you.
Changing your password via https://account.apple.com/account/manage fixes the issue by updating these values to Apple's servers.