Skip to content

Checkout tokens

Checkout tokens let automation, scripts, and brokers create and check in Bridge checkouts through the HTTPS API. They are available in v3.0.2 and later and are disabled by default.

These credentials manage checkouts. They do not sign users in or authenticate to recording, monitoring, or token-management endpoints. For read-only monitoring, use service tokens. A checkout token is also separate from the per-checkout token field in the payload reference.

Before you begin

  • Serve Bridge over HTTPS and allow the API client to reach that address.
  • Sign in with active admin access, such as an admin checkout, to manage tokens.
  • Provide a secret store or protected file for the client to read the token.

Enable checkout tokens

Add these settings to your Bridge configuration:

bridge.yaml
server:
  checkout_api_tokens:
    enabled: true
    max_token_days: 90

Roll out the configuration to every serving replica. Environment overrides are BRIDGE_SERVER_CHECKOUT_API_TOKENS_ENABLED and BRIDGE_SERVER_CHECKOUT_API_TOKENS_MAX_TOKEN_DAYS.

If a load balancer terminates HTTPS, keep server.secure_cookies: true and restrict access to the plaintext backend. Bridge refuses checkout token access when both server TLS and secure cookies are disabled.

max_token_days sets the maximum and default lifetime for new tokens. Its default is 90, and valid values are 1 to 36500. Changing the limit does not change existing expiration dates. See the configuration reference.

Create a checkout token

Set a name and expiration

Open Admin > API Tokens > Checkout tokens. Enter a name that identifies the client or automation. Set the expiration in whole days, up to the configured maximum. The form starts at that maximum.

Choose the scope

Open Advanced Settings and restrict the token to the access its client needs:

  • Checkout roles starts with User, Admin, and Auditor selected. Deselect roles the client does not need. A token that allows Admin can create admin grants.
  • Protocols starts with all currently enabled protocols selected. These restrictions apply to user checkouts. Admin and auditor grants have no target protocol. Enabling another protocol later does not add it to existing tokens.
  • Network restrictions starts with 0.0.0.0/0, allowing any IPv4 source. Replace it with the client’s source CIDRs. Add IPv6 CIDRs when needed. Use /32 for a single IPv4 address or /128 for a single IPv6 address.

Network restrictions match the API caller, not the checkout target. If a reverse proxy forwards requests, configure only actual proxies in server.trusted_proxies. A trusted proxy must provide valid client-address information for network-restricted requests.

Save the token

Select Create, then Copy token in the dialog. Save the token in the client’s secret store before selecting Done. If copying fails, select the token text and copy it manually.

The dialog shows the token once. Closing it clears the displayed value. Bridge stores only a hash and cannot show the token again.

A token remains valid after its creator’s admin checkout ends. Further token management requires active admin access.

Configure the client

For bsh, supply the token through BSH_BRIDGE_BROKER_API_TOKEN, either directly or as a secret reference. A protected file is also supported through BSH_BRIDGE_BROKER_API_TOKEN_FILE. The external broker guide covers the HTTPS URL, CA trust, and permission variables.

Other API clients send the token in X-Bridge-Broker-Token. The checkout API reference lists the allowed routes. Tokens do not authorize other API operations.

Verify

Request a permission within the token’s scope. Confirm that the intended user receives the expected access, then check in the permission and confirm that access ends. For bsh, follow the broker verification steps.

For an API-only client, GET /api/broker/validate returns the token’s checkout group, roles, and protocols. GET /api/transactions lists its active checkouts within scope. Validation alone does not test target connectivity or cleanup.

Each independently created token owns an isolated checkout group. It cannot inspect or check in another group’s checkouts, including those created by the colocated broker. Replacing a token preserves its group.

Replace a token

Replace an active token before it expires:

  1. Expand its name under Checkout tokens and select Replace.
  2. Give the replacement a unique name and an expiration. Review the role, protocol, and network restrictions copied from the original token.
  3. Select Create and save the replacement token from the dialog.
  4. Update the client’s token source and repeat the verification.
  5. After checkout and checkin succeed, select Revoke for the old token.

Replace preserves the checkout group so the replacement can manage existing checkouts within its scope. Creating an unrelated token starts a different group.

Revoke a token

If access must end now, check in the token’s existing checkouts before revoking it. Revoking the token alone does not end those checkouts.

Expand the token’s name under Checkout tokens and select Revoke. Revocation and expiration stop subsequent requests on every replica without a restart. Already-authorized requests can finish. Existing checkouts keep their own expiration.

Disable checkout tokens

Set server.checkout_api_tokens.enabled: false and roll out the configuration to every serving replica. Stored tokens remain available if the feature is re-enabled, subject to their expiration and revocation. Existing checkouts keep their own expiration.

Troubleshoot

SymptomCheck
Checkout tokens are disabledEnable server.checkout_api_tokens.enabled on every serving replica.
Creation controls are unavailableObtain active admin access and reopen the panel.
Creation fails with a duplicate nameChoose a name not used by another live token.
Authentication failsCheck the token source, secret-store access, expiration, revocation status, and HTTPS URL.
A network restriction denies the callerMatch the client’s source address to the allowed CIDRs and check trusted-proxy configuration.
A checkout is absent or creation is refusedCheck the token’s checkout group, roles, and protocols.
Last updated on