Hey
We see you're getting an error when attempting to log into iCloud Are you able to log into iCloud in Settings > [your Name] on the iPhone: Sign in with your Apple ID
If so, have you tested using a different web browser on the iPhone? Does this happen when trying to log into the website from a different device or a computer?
If you're able to log in on a different device, start with making sure the time, time zone, and date are correct. To see the time zone, go to Settings > General > Date & Time. If it isn't correct, turn off "Set Automatically", and correct it. Afterward turn "Set Automatically" back on and make sure it doesn't change to the incorrect time zone. The date can be checked in the Calendar app.
If that doesn't help, try with a different Wi-Fi network. If issue continues, reset network settings by tapping Settings > General > Reset > Reset Network Settings. This also resets Wi-Fi networks and passwords, cellular settings, and VPN and APN settings that you’ve used before.
Let us know if any of this helps. Best wishes.