If you are using Mac and, some conditions are met like Apple ID address is same as your web mail account ( like gmail ) and in the location system preferences > iCloud the same Apple ID is signed in , the boxes for keychain , safari ... are checked and you have already set up iCloud Keychain .
When you change this Apple ID account to two factor authentication , a mail will be received in your web mail account ( that is on rescue mail address ) , open the web account with its mail address and password , you can see a link , in the inbox mail you will see reverse two step authentication link just click on it , its easy method than entering in Apple ID . apple.com and then disabling it from there , the time limit is 2 weeks , after that the link will expire .
Once you have clicked on the link in system preferences > Below keychain you will see this error .
This will delete the iCloud verification code from iCloud server , so how to remove this error and set up a new iCloud verification code see these steps -
If you enable two step authentication in Mac , there will be an error waiting for approval from another device below keychain , in system preferences > iCloud is opened and you won't be able to set up iCloud Keychain .
To sort out this problem , enter with the same Apple ID and password in Mac and iOS device .
In iOS device go to settings > iCloud > Keychain set up a passcode and write down the code in a safe place .see this articleUse a passcode with your iPhone, iPad, or iPod touch - Apple Support
Only follow the paragraph in the article how to generate passcode .
Then follow this article Frequently asked questions about iCloud Keychain - Apple Support
See the paragraph of how to set up iCloud keychain in this article .
The 4 th point -
Follow the onscreen instructions.
These steps are not mentioned in the article , you have to follow the steps by itself and has to take help of apple support senior advisor only .
A lengthy procedure is there and click on request for approval , you have to generate a new iCloud security code by typing in iOS screen example 6785 , and write down in safe place so that it will always help in future if any iCloud Keychain problems come .
The box of keychain in iCloud will get checked but still an error will be shown unable to connect to iCloud , open options button in front of keychain check the box of allow approving with security code but you will notice the trusted mobile number of yours is not being added , it can be added once again take help of apple support senior advisors Contact Apple for support and service - Apple Support