How can I verify archive with two factor authentication?

I am running Xcode on Yosemite and have finished a new version of an app. I want to make an ad hoc distribution for testing as done with previous versions but this is now blocked as I cannot upgrade my appleID - Xcode connection with the now compulsory two factor code. There's no place to type it in. I started with Xcode 6.4 but have since moved to 7.2, but the issue is still there. How far do I have to upgrade (OS and Xcode) in order to be again able to work and distribute?