google-auth-library-python icon indicating copy to clipboard operation
google-auth-library-python copied to clipboard

token_state Property Documentation Needs Fixing

Open mkf62 opened this issue 10 months ago • 0 comments

Every single token_state property in the documentation provides this as the property description:

See :obj:TokenState

This is super unhelpful when the properties expired and valid both say they are deprecated and to use token_state instead:

Deprecated since version v2.24.0: Prefer checking [token_state](https://googleapis.dev/python/google-auth/latest/reference/google.oauth2.credentials.html#google.oauth2.credentials.Credentials.token_state) instead.

For reference, I am specifically looking at the google.oauth2.credentials module page but anywhere you find the token_state parameter in the docs, it is described the same way.

It's difficult to know what to check in token_state when the documentation describes nothing about it. I cannot find anything about this property anywhere on the internet. When I check credentials.token_state in a watch during a debugging session, I see name: 'FRESH' and value: 1 which seems somewhat self explanatory, but what other values might I see if the token is no longer valid or it is expired? When I print the value, I get this... what am I supposed to be checking for in token_state in relation to the deprecated properties expired and valid?

print(credentials.token_state)
# TokenState.FRESH

mkf62 avatar Mar 03 '25 00:03 mkf62