The 2FA via email case is great. I recently had to build a browser automation workflow that required 2FA. I ended up using Zapier to monitor email inbox and then extract the code and send back to our API. It was a bit slow.
Alternatively you can set up IMAP access.
Obviously you have to be able to configure proper OAuth2 keys to do this, but again, that's another 30 seconds spent in Grok/GPT/Claude/whatever.