Skip to content

google.auth.default() fails to retreive project_id #16090

@uweber

Description

@uweber

Determine this is the right repository

  • I determined this is the correct repository in which to report this bug.

Summary of the issue

Context
google.auth.default() will use http.client as default transport, but mTLS support needs session support to work

Expected Behavior:
return proper project_id with default transport

Actual Behavior:
returned project_id is None

API client name and version

google-auth 2.49.0

Reproduction steps: code

file: main.py

import google.auth
credentials, project_id = google.auth.default()
assert(project_id)

Worked in 2.43.0 and broke with 2.44.0 and later due mTLS support, which has a hard requirement for requests.

Workaround:
file: main.py

import google.auth
from google.auth.transport.requests import Request
credentials, project_id = google.auth.default(request=Request())
assert(project_id)

Reproduction steps: supporting files

No response

Reproduction steps: actual results

No response

Reproduction steps: expected results

No response

OS & version + platform

Debian 12

Python environment

3.11.2

Python dependencies

No response

Additional context

No response

Metadata

Metadata

Assignees

Labels

authpriority: 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