- 
                Notifications
    You must be signed in to change notification settings 
- Fork 176
          Use Google Auth's load_credentials_from_* Methods
          #1041
        
      base: main
Are you sure you want to change the base?
  
    Use Google Auth's load_credentials_from_* Methods
  
  #1041
              Conversation
| I'd also note that  | 
01f2c1b    to
    c9b60d5      
    Compare
  
    | notes from sync: specifically look at impact on profile. | 
| Any update on this PR? External accounts in a key-file currently doesn't work. I suspect this may fix it. | 
| For what it's worth @joewood you can just stick your external account creds in  | 
| Thanks @chrisguitarguy, we actually use WIP and a custom IDP so the OAUTH approach doesn't work. I'm actually running with your fork and I needed to add a new auth type "default", which does a simple:   credentials, _ = google.auth.default(scopes=profile_credentials.scopes)This gets around the issue entirely and uses the active WIP service account (for us at least). | 
| Thanks for the PR @chrisguitarguy! We're in the process of updating our credential and connection management for dbt-bigquery and this looks like a solid improvement. Do you mind resolving conflicts between your branch our  | 
These methods handle services accounts as well any any other credential method. Got someone using DBT with AWS-based Auth (see dbt-labs#86)? This will work with AWS Auth. Typical service account auth with a key file and oauth2 jwt assertion grant stuff still works and is covered here: https://github.com/googleapis/google-auth-library-python/blob/v2.14.1/google/auth/_default.py#L408 I did add `google-auth>=2.20.0` which is the first version that has `load_credentials_from_dict`. Previously this lower bound was v2.14.1 (from `google-api-core>=2.11`). Basically this will just let folks auth bigquery however they would auth any gcloud resources without any extra effort. And the previous versions config still works exactly the same.
c9b60d5    to
    57a016d      
    Compare
  
    | @mikealfare sorry, I did not see your november message until now. I sorted out the conflicts (basically by re-doing this PR from the current  | 
These methods handle services accounts as well any any other credential method. Got someone using DBT with AWS-based Auth (see #86)? This will work with AWS Auth.
Typical service account auth with a key file and oauth2 jwt assertion grant stuff still works and is covered here: https://github.com/googleapis/google-auth-library-python/blob/v2.14.1/google/auth/_default.py#L408
DBT BigQuery requires google-api-core>=2.11 which requires google-auth>=2.14.1 which supports oauth2 service acounts as well as other things.
Basically this will just let folks auth bigquery however they would auth any gcloud resources without any extra effort. And the previous versions config still works exactly the same.
resolves #86
docsnot necessary, IMO? Maybe some additional examplesProblem
Right now DBT auth is limited to service account credentials, which requires a private key for JWT assertion oauth2 grants.
Solution
Instead of using the service account auth directly, use
google.auth'sload_credentials_from_fileandload_credentials_from_dictwhich support the already existing usage cases as well as any other type of gcloud auth the SDKs support.Checklist