Access tokens

Access tokens let package managers and CI use Pratique, and they are how the audit log knows who pulled each package. Give each person and each bot their own.

Kinds of token

You create tokens under Access tokens. Admins choose who a token is for in the For list. People without the admin role can create only personal tokens.

Choice in ForUse it forWho can create itShown in Activity as
MeA personal token, for your own machineAnyone signed inalice@example.com (laptop)
A bot or CI systemA CI system or service, so records name the system and not the person who made the tokenAdminsbot:ci
An AI triage agentAn AI that connects over MCP to review what needs attentionAdminsbot: and the token name

A token can also come from pratique-connect, which creates a personal token when you approve its sign-in. Those tokens are named connect: and the machine's host name, last 90 days, and cannot publish. Revoke them here like any other token, or run pratique-connect logout on the machine.

In the token list, bot tokens have a Bot tag and AI triage tokens an AI agent tag. The Access column shows Read, Read and publish or Triage.

Publish access

Admins can select Can publish private packages on a personal or bot token. The token can then publish packages under reserved names, in artifactory mode. See private packages.

  • A personal token with publish access must expire within 90 days. Use a bot token for CI.
  • A personal token loses publish access when its owner signs in and is no longer an admin.
  • An AI triage token cannot publish.

AI triage tokens

An AI triage token works only at /mcp. It cannot download packages or sign in to the web UI. A package manager that uses one gets HTTP 403, "an AI triage token can only be used at /mcp".

Select AI agent can see who downloaded what only if the agent needs it, because it exposes people's identities. Each such lookup is recorded in the audit log. See AI triage.

Create a token

  1. Name it

    Open Access tokens. Under Create a token, enter a Name of up to 60 characters, such as laptop or ci. The name appears in the audit log, so make it say where downloads come from.

  2. Choose when it expires

    In Expires, choose one of these:

    OptionNotes
    90 daysThe first option in the list.
    30 days
    1 yearNot allowed for a personal token with publish access.
    No expiryNot allowed for a personal token with publish access.
  3. Choose a team, if offered

    A token in a team gets that team's quarantine and rules. See teams on tokens.

  4. Copy the token

    Select Create token. The page shows the token under Copy your token now. This is the only time it is shown, because Pratique stores only its hash. Tokens start with prq_.

    Under Use it, the page shows the settings for npm, pip, uv, Composer and Go with your token filled in. Copy the ones you need.

How clients send the token

npm, pnpm and Yarn send the token as a bearer token. pip, uv, Poetry, Composer and Go send it as the password of a basic login. Pratique ignores the user name, and the examples in this guide use token. See the page for your tool: npm, Python, Composer or Go.

Teams on tokens

A token with no team follows the default policy. A token in a team follows that team's quarantine and rules. See teams.

  • If you are in one team, your personal tokens use it. The page says "You're in team …, so your tokens use its policy and report for it."
  • If you are in several teams, you choose one in Team when you create the token, or Default policy. You can only choose a team you belong to.
  • Admins can put any token, except an AI triage token, in any team. In the token list, choose a team in the Team column and select Move. The token's next request uses the new policy.
  • Personal tokens follow their owner. When someone leaves a team's groups, their personal tokens stop acting for that team. Bot tokens keep the team an admin chose.

Revoke a token

Select Revoke next to the token. It stops working at once, and the client gets HTTP 401. You can revoke your own tokens. Admins can revoke anyone's.

An expired token stops working in the same way. The Last used column shows when each token last made a request, which helps you find tokens that nobody uses.

When someone leaves

Removing a person from single sign-on ends their web access, but does not revoke their access tokens. Revoke those under Access tokens. With SCIM, switching a person off stops their personal tokens at once, but tokens they made for bots keep working, so that a production build does not stop. See sign-in.

Tokens from the command line

On the server's shell, pratique token create, list and revoke manage tokens for setup scripts. See CLI reference.

Tokens in the config file

You can also define bot tokens in the config file, under access.client_tokens, or in the PRATIQUE_CLIENT_TOKENS environment variable. Each token must be at least 16 characters.

yamlpratique.yaml
access:
  client_tokens:
    ci: ${PRATIQUE_CI_TOKEN}
bashenvironment variable
PRATIQUE_CLIENT_TOKENS=ci:FIRST_TOKEN,deploy:SECOND_TOKEN
  • These tokens count as bots, and Activity shows them as bot: and their name, such as bot:ci.
  • To put one in a team, list its name under the team's tokens in the config file.
  • To change or revoke one, change the config and restart Pratique.
  • Any token defined here turns off anonymous access.

See configuration.

Anonymous access

On a server that is entirely local, clients can connect without a token. Their downloads show as anonymous, so an incident cannot say whose machine to check. All of these must be true:

  • Pratique listens on a loopback address, such as 127.0.0.1:8484.
  • Its public URL is a local address.
  • It does not trust a proxy (PRATIQUE_TRUST_PROXY is off).
  • No client tokens are defined in the config file or in PRATIQUE_CLIENT_TOKENS.
  • access.require_tokens is not true. PRATIQUE_REQUIRE_TOKENS=true does the same.

Otherwise, every client needs a token. The Docker image listens on all of the container's addresses, so a container always needs tokens. A wrong or expired token is always refused, even where anonymous access is on, so that a typo does not quietly lose your identity in the log.

What Activity records

Each decision for a client is recorded against its token's person or bot. The Cleared tab of Activity shows who pulled which package and version, when, and from what address. You can filter by client, such as client:bot:ci*, and export the results as CSV.

  • Only files that a client received count as downloads. Resolving a dependency or sending a HEAD request does not.
  • Creating and revoking a token are recorded too, under the Admin tab.

See the dashboard.