Skip to content

Type 2: include data about PAT expiry #1197

Description

@kykrueger

Summary

When authenticating with a personal access token (PAT) a duration until the expiry of the token is returned by the login request.
This information is dropped by the python client, yet would be useful to have it logged as a warning when the expiration date is near.

Description

As users of the python client, we have automated some data-engineering tasks, and authenticate with PATs.
Since the PATs may be configured to expire after a given period of time, it is necessary to keep track of when tokens need to be renewed.

The time until expiry is available in the following REST Request:
https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_concepts_auth.htm#make-a-sign-in-request-with-a-personal-access-token

Since this request is already made as a part of the authentication process in the python client, I would like to extend the client to pass two optional parameters to the sign_in method:

  • token_expiry_warning_threshold: Optional[int] = 60
  • token_expiry_warning_callback: Optional[Callable[[str], None]]

The provided threshold should be an integer which represents days. If the token is set to expire in less days than in the threshold, a warning should be logged. I think 60 days is a sane default given the default expiration period is after 1 year.
A callable may also be provided which will be called with the string containing the time until expiry as received from the API. Its format is "days:hours:seconds".

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions