Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(translate-v2): Ensure access token is fetched with recent googleauth versions in the non-api-key case #28096

Merged
merged 1 commit into from
Dec 11, 2024

Conversation

dazuma
Copy link
Member

@dazuma dazuma commented Dec 11, 2024

This may address googleapis/google-auth-library-ruby#504. It also addresses some integration test failures related to the translate-v2 client.

Older versions of googleauth (prior to 0.11 or 0.12) eagerly fetched access tokens for some credential types. This could cause issues in environments where the service providing the tokens were slow to initialize. It also did extra work by fetching a token prematurely if the credential was never used or was delayed in its use, and would cause confusion when troubleshooting auth via logs use because the token fetch would be significantly separated from its use.

This eager pre-fetching was removed in more recent versions of googleauth, but it looks like the translate-v2 client was depending on the old behavior: its logic failed ever to fetch a token if no previous token (and thus no expiration date) was already present. This PR updates the translate-v2 client logic to ensure a token is fetched if not present at all.

@dazuma dazuma force-pushed the pr/translate-v2-auth-fix branch from 00e3e36 to 39a94d0 Compare December 11, 2024 20:10
@dazuma dazuma force-pushed the pr/translate-v2-auth-fix branch from 39a94d0 to f797c30 Compare December 11, 2024 20:12
@dazuma dazuma requested a review from aandreassa December 11, 2024 20:20
@dazuma dazuma merged commit 398f03d into googleapis:main Dec 11, 2024
12 checks passed
@dazuma dazuma deleted the pr/translate-v2-auth-fix branch December 11, 2024 22:16
@github-actions github-actions bot added the release-please:force-run To run release-please label Dec 12, 2024
@release-please release-please bot removed the release-please:force-run To run release-please label Dec 12, 2024
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.

2 participants