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

Replacecredentials.valid check for credentials.token_state #286

Closed
jackwotherspoon opened this issue Mar 24, 2024 · 1 comment · Fixed by #321
Closed

Replacecredentials.valid check for credentials.token_state #286

jackwotherspoon opened this issue Mar 24, 2024 · 1 comment · Fixed by #321
Assignees
Labels
priority: p2 Moderately-important priority. Fix may not be included in next release. type: cleanup An internal cleanup or hygiene concern.

Comments

@jackwotherspoon
Copy link
Collaborator

New best practice for checking validity of credentials is no longer credentials.valid which is now deprecated (as of google-auth v2.24.0). Instead the google-auth folks recommend using credentials.token_state

All instances of the following:

if not self._credentials.valid:
request = Request()
self._credentials.refresh(request)

Should be replaced to:

from google.auth.credentials import TokenState

# ...
if not self._credentials.token_state == TokenState.FRESH:
    self._credentials.refresh(google.auth.transport.requests.Request())
@jackwotherspoon jackwotherspoon added priority: p2 Moderately-important priority. Fix may not be included in next release. type: cleanup An internal cleanup or hygiene concern. labels Mar 24, 2024
@jackwotherspoon jackwotherspoon self-assigned this Mar 24, 2024
@jackwotherspoon
Copy link
Collaborator Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: p2 Moderately-important priority. Fix may not be included in next release. type: cleanup An internal cleanup or hygiene concern.
Projects
None yet
1 participant