Thanks to visit codestin.com
Credit goes to github.com

Skip to content

google.auth.default(quota_project_id="..") still results in end user credentials warning #769

@busunkim96

Description

@busunkim96

quota_project_id is not currently passed through to _get_gcloud_sdk_credentials. This bit of code still results in the end user credentials warning:

import google.auth

credentials, project_id = google.auth.default(quota_project_id="my-project")

def _get_gcloud_sdk_credentials():
"""Gets the credentials and project ID from the Cloud SDK."""
from google.auth import _cloud_sdk
_LOGGER.debug("Checking Cloud SDK credentials as part of auth process...")
# Check if application default credentials exist.
credentials_filename = _cloud_sdk.get_application_default_credentials_path()
if not os.path.isfile(credentials_filename):
_LOGGER.debug("Cloud SDK credentials not found on disk; not using them")
return None, None
credentials, project_id = load_credentials_from_file(credentials_filename)
if not project_id:
project_id = _cloud_sdk.get_project_id()
return credentials, project_id

def load_credentials_from_file(
filename, scopes=None, default_scopes=None, quota_project_id=None, request=None
):

Metadata

Metadata

Labels

priority: p2Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions