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

refactor: use google.auth TokenState for credentials validity #321

Merged
merged 1 commit into from
May 24, 2024

Conversation

jackwotherspoon
Copy link
Collaborator

In the google.auth package, it is now recommended to use .token_state
over .valid for checking validity of credentials.

Token state gives more information such as if token is stale, expired,
invalid etc.

.valid is now marked as deprecated (code):

@property
def valid(self):
    """Checks the validity of the credentials.

    This is True if the credentials have a :attr:`token` and the token
    is not :attr:`expired`.

    .. deprecated:: v2.24.0
      Prefer checking :attr:`token_state` instead.
    """
    return self.token is not None and not self.expired

Closes #286

Should also unblock #245

@jackwotherspoon jackwotherspoon self-assigned this May 24, 2024
@jackwotherspoon jackwotherspoon requested a review from a team as a code owner May 24, 2024 16:01
@jackwotherspoon jackwotherspoon merged commit fd87bfd into main May 24, 2024
15 checks passed
@jackwotherspoon jackwotherspoon deleted the token-state branch May 24, 2024 16:33
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.

Replacecredentials.valid check for credentials.token_state
2 participants