I had the same issue between Mac and iPhone - tried several things but this is the one which worked:
- On the Mac - Open Message App
- On the iPhone - Settings - Enabled "Text Message Forwarding" and select the device you like to forward messages to, in my case "My Mac"
- On the Mac - No code displayed
- On the iPhone - I pressed Allow without entering code.
- On the Mac - Immediately Mac gave me a message that forwarding is cancelled
- On the Mac - I pressed OK
- On the Mac - Right after cancellation message, code appeared but this code was connected to first iPhone forwarding sync
- On the Mac - Don't cancel this code or don't do anything with this message
- On the iPhone - Try enabling forwarding again
- On the Mac - Now cancel the first code then correct code will appear right away
- On the iPhone - Enter the latest code displayed on Mac on the iPhone
- On the iPhone - Allow
Done - Enjoy your connected synch life 🙂
Hope this helps, you might have to play with allow and cancel on the iPhone and Mac few times for the correct code but this will work. It is definitely a bug but I managed to fix it with the above solution. Hope Apple works this out soon.