Incorrect passcode when signing in to icloud
My MacBook Pro (13" 2017) with macOS Catalina 10.15.7 tells me I need to sign in to iCloud again. I open System Preferences and there is also the suggestion; "Update Apple ID settings". I select "details ..." to learn more: "Some account services will not be available until You sign in again".
I select "Continue" and I get a pop-up asking me to enter (Apple ID) password to set up iCloud. (Note to self: iCloud has been set up earlier successfully, nothing wrong with it).
I enter my Apple ID password. The pop-up dissappears. Soon appears another pop-up, now asking me to enter my Mac password. I enter my Mac password and the pop-up dissappears.
Then third pop-up appears, now asking me to "enter the passcode you use to unlock the iPhone". I enter my iPhone passcode (note: I happen to have four digit passcode on my iPhone, the pop-up asking the passcode has room for six digits). After having typed in my iPhone (four digit) passcode I select "Continue". It takes few seconds and my Mac replies to me with new pop-up telling me that my Mac is not happy with what I just typed; "Incorrect passcode". Enter the iPhone passcode again.
I choose the only available option "ok". I get back to the previous pop-up where I can type my iPhone passcode again. And select "Continue" only to learn again that my passcode is incorrect.
This is frustrating, since at the same time I do apply the passcode to my iPhone to open it and it works - of course.
Any suggestions how to work around this frustrating Apple bug?