There are many reasons that you may want to change or reset the iCloud Keychain security code, especially the situation that forgot the iCloud Security Code and found your device locked out of the whole iCloud system. This post shows how to recover the security code in different scenarios.
If you reset iCloud Keychain, it will delete all passwords stored in iCloud. If you are sure you want to reset iCloud Keychain, just do as follows:
Step 1: Go to Settings, tap your Name > iCloud > Keychain and turn on iCloud Keychain. Enter Apple ID password if asked.
Step 2: Tap Approve with Security Code.
Step 3: Tap Forgot Code instead of entering your iCloud security code.
Step 4: Tap Reset iCloud Keychain to replace your Keychain in iCloud with the iCloud Keychain from your device. Then confirm Reset action.
Step 5: Follow the onscreen steps to create a new iCloud Security Code.
After entering a verification number, enter the password for Apple ID, iCloud Keychain has been reset.
If you can access an approved device that uses your iCloud Keychain, you can create a new iCloud Security Code. If no devices are available, reset iCloud Keychain.
Step 1: Go to Settings > iCloud > Keychain > Advanced.
Step 2: Tap Change Security Code. Enter your Apple ID password if prompted.
Step 3: Then enter a new iCloud Security Code. You can also tap on Advanced Options to choose a more complex code or have one generated for you. After done, iCloud will update the information to use new security code.
Reference: What is iCloud Keychain?