Two factor authetication codes when using two apple ID's

Problem:

Being logged into my iPhone, Mac and iPad in iCloud with an apple ID (1) but another apple ID (2) on App store, a situation I can’t solve happens:

Having two factor authentication turned on on my apple ID 2 I sometimes (when for instance loggin into my Apple TV to watch a movie I bought in iTunes with my apple ID 2) I’m requested to write the code that ”will show up on one of my trusted devices”. Well, even if I’m logged into app store on all of my devices with apple ID 2 no code or message is displayed in these situations. Of course this is because I’m logged into iCloud with another apple ID (1) on all my devices. So the question is: how do I retrieve the code in this case (without turning off two factor authentication)?

You click on “Didn’t recive the code” and get is as a text message.

That message only appears on certain devices, not on my Apple TV…

If you’re signed into the right account on an iOS device, you can go to Settings > your name > Password and Secutiry > Get verification code. I think you can do the same on macOS.

Try creating a second local user account on your Mac and, as that user, log into iCloud with Apple ID 2. When you need the 2FA code, use fast user switching to jump over to that Mac account to get the 2FA code.