Problem: On a 2015 MacBook Air with MacOS 10.10.5 (Yosemite) installed, i could not log in to iCloud. Even when submitting the correct password, it would say "incorrect password".
Why that happens: On an already logged in second device, you will be asked to approve the login attempt. It will also show a six digit code that should be submitted on the new device. But there is no input for pasting the six digit code, right?
Solution: Just submit your password and add the six digits directly after the password, then click submit. It should work now!