|
1 | | -// Copyright 2023 Google LLC |
| 1 | +// Copyright 2026 Google LLC |
2 | 2 | // |
3 | 3 | // Licensed under the Apache License, Version 2.0 (the "License"); |
4 | 4 | // you may not use this file except in compliance with the License. |
@@ -56,8 +56,12 @@ export class WorkloadIdentityFederationClient extends Client implements AuthClie |
56 | 56 | this.#workloadIdentityProviderName = opts.workloadIdentityProviderName; |
57 | 57 | this.#serviceAccount = opts.serviceAccount; |
58 | 58 |
|
59 | | - const iamHost = new URL(this._endpoints.iam).host; |
60 | | - this.#audience = `//${iamHost}/${this.#workloadIdentityProviderName}`; |
| 59 | + if (opts.audience) { |
| 60 | + this.#audience = opts.audience; |
| 61 | + } else { |
| 62 | + const iamHost = new URL(this._endpoints.iam).host; |
| 63 | + this.#audience = `//${iamHost}/${this.#workloadIdentityProviderName}`; |
| 64 | + } |
61 | 65 | this._logger.debug(`Computed audience`, this.#audience); |
62 | 66 | } |
63 | 67 |
|
@@ -88,7 +92,7 @@ export class WorkloadIdentityFederationClient extends Client implements AuthClie |
88 | 92 | audience: this.#audience, |
89 | 93 | grantType: `urn:ietf:params:oauth:grant-type:token-exchange`, |
90 | 94 | requestedTokenType: `urn:ietf:params:oauth:token-type:access_token`, |
91 | | - scope: `${this._endpoints.www}/auth/cloud-platform`, |
| 95 | + scope: `https://www.googleapis.com/auth/cloud-platform`, |
92 | 96 | subjectTokenType: `urn:ietf:params:oauth:token-type:jwt`, |
93 | 97 | subjectToken: this.#githubOIDCToken, |
94 | 98 | }; |
|
0 commit comments