Skip to content

fix: authentication failures when using Google Cloud universes#349

Open
jnahelou wants to merge 1 commit into
hashicorp:mainfrom
jnahelou:fix/oauth2-with-universe-auth-failure
Open

fix: authentication failures when using Google Cloud universes#349
jnahelou wants to merge 1 commit into
hashicorp:mainfrom
jnahelou:fix/oauth2-with-universe-auth-failure

Conversation

@jnahelou

@jnahelou jnahelou commented Jun 8, 2026

Copy link
Copy Markdown

Description

This PR fixes an authentication issue when using custom universe domains with a tokenSource.

When initializing a tokenSource, the universe domain must be explicitly passed to it. Otherwise, it falls back to the default Google universe domain (googleapis.com), causing a credential mismatch error and failing to authenticate requests.

In the same way, when using DefaultTokenSource, the universe domain was not properly propagated, causing the same issue.
To resolve this, I switched to using FindDefaultCredentials, which natively includes proper support for custom universe domains and correctly parses the environment's credentials.

Related Logs / Error Output

When the universe domain is not explicitly configured on the tokenSource, the following error occurs during the project metadata retrieval:

2026/06/08 22:31:05 failed to get project metadata: Get "https://compute.s3nsapis.fr/compute/v1/projects/s3ns%3Aredacted-project?alt=json&prettyPrint=false": the configured universe domain ("s3nsapis.fr") does not match the universe domain found in the credentials ("googleapis.com"). If you haven't configured the universe domain explicitly, "googleapis.com" is the default.

@jnahelou jnahelou requested a review from a team as a code owner June 8, 2026 20:38
@hashicorp-cla-app

hashicorp-cla-app Bot commented Jun 8, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant