Usually in Python what I do, I get the application default credentials, I get the access token then I refresh it to be able to authenticate to a private environment.