Notifications from Apple TV on iPhone asking to allow login to Apple ID
That code that your iPad and iPhone are asking for is the two-factor authentication code. If you dont see a code on your Apple TV then the next best step for you is to go to http://www.appleid.apple.com and then sign in, get the code from one of your devices, then when in your account go under "security". In security look for two-factor authentication ON. If it is on, click edit on the far right hand side in security then you'll see "turn off two-factor authentication".

You'll want to turn it off in order to bypass the requesting of a code. Once you attempt to turn it off it'll ask you to create 3 security question (with answers) and double check your birthdate &amp; rescue email (if you have one).

Once you've turned off two-factor authentication all of the devices that you are signed into will ask your to "update" your Apple ID by putting in your password to the account. It knows that you changed the security type to your account and wants to verify that you permitted it. After that you should have no problem getting the Apple TV working again.

***You may need to reset the Apple TV and its connection to your internets signal if its still not working. The above fix is just to get rid of those prompts, but it wont fix the connection.

Let me know if you have any concerns/questions/issues.