Basic Auth On Anvil App List

What I’m trying to do:
I’m trying to scrape the list of apps on my account. Ultimately I will want to do this from a published Anvil app, but I also want to do it from a separate, stand alone app in the mean time.

What I’ve tried and what’s not working:
curl -u USERNAME:PASSWORD "https://anvil.works/ide/apps"

but it returns :

{“error”:“unauthenticated”}

It works from a browser when I’m logged in to Anvil, but not from a command line (and therefore not from any other app that is not logged into my main anvil account).

How do I do this?

Worth noting I have 2FA on my account as well.

EDIT - I just found this : Programmatically access data about my Anvil apps - #7 by stefano.menci from @stefano.menci but this won’t work with 2FA enabled.

So I guess my question remains the same but with emphasis on working with 2FA. I don;t really want to disable that unless there is no other way.