• 
      

    Add flexibility and time-sensitivity when creating client API tokens.

    Review Request #15104 — Created June 7, 2026 and updated — Latest diff uploaded

    Information

    Review Board
    release-8.x

    Reviewers

    WebAPIToken.objects.get_or_create_client_token() can now be given a
    Local Site for filtering or creating tokens, as well as a default
    extra_data and a default token policy for new tokens. This gives
    callers more control over the resulting token.

    It also now takes a min_validity_secs, which specifies the minimum
    time an existing token must be valid in order to be considered. This
    defaults to 5 minutes, which should be a good minimum default for
    anything that may need to perform an immediate operation. Callers can
    pass in a longer validity window.

    Unit tests pass.

    Commits

    Files