Skip to content
Scalpels home

Sign up now for $10 in credit on a new Laravel Cloud account.

Documentation

Crate

Credentials

Updated

Every request for /packages.json, /p2/... or /dist/... must carry a registry credential. Composer sends it as HTTP Basic auth: the username can be anything (Crate's tools use token) and the password is the credential.

What a registry credential can do

A registry credential is a Basic credential with the purpose crate.composer.consume. That purpose lets it download Composer metadata and archives, and nothing else. It cannot add or remove repositories, read source tokens or manage credentials.

One active registry credential can read every package your Crate serves. There is no way to limit a credential to some packages.

Crate answers every request without a valid registry credential with the same 401 and a WWW-Authenticate: Basic realm="Crate" header, whether the credential is missing, malformed, for another purpose, not Basic, expired, revoked, or belongs to a removed account. It never says which.

Personal and installation credentials

You issue both kinds from Settings after signing in. Owners, Admins and Members can all issue them.

  • Personal credentials belong to you. They keep working only while your account is active and allowed to use Crate, so they stop working when you are deactivated. Use them on your own machine.
  • Installation credentials belong to the Crate deployment rather than to a person, and keep working when the person who issued them leaves. Use them for servers, CI and other applications. Each one carries a subject reference, a label for the automation that uses it, such as billing-worker.

When Scalpels attaches one of your applications to Crate, it issues the credential for you and writes it straight into that application's environment. See Connecting your apps.

Issue a credential

  1. Open Settings → Personal credentials or Settings → Installation credentials.
  2. Under Issue a credential, choose crate.composer.consume / basic.
  3. Enter a name. For an installation credential, also enter the subject reference.
  4. Select Issue.

Crate shows Save this credential now with the username and password. This is the only time the password is shown. Put it directly into the secret store, environment variable or auth.json that needs it; do not paste it into chat, commits or logs.

Connect your machine

The quickest way to set up Composer on your own computer is Connect this machine in Crate's sidebar.

  1. Open Crate from Scalpels and select Connect this machine.
  2. Select Get my command.
  3. Copy the command Crate shows into your terminal and run it. It looks like this:
curl -fsSL https://crate.example.com/connect/crx_... | sh

The script issues a personal credential in your name and saves it to your global Composer auth.json (usually ~/.composer/auth.json) with composer config --global --auth. The credential is never shown on screen, and it does not end up in a project where it could be committed by accident.

The code in the command works once, within 10 minutes. If it expires, select Get my command again. To read the script before you run it, open the address from the command in your browser. Looking at the script does not use up the code.

A credential issued this way is an ordinary personal credential. It shows up under Settings → Personal credentials, where you can rotate or revoke it, and it stops working if your account is deactivated.

Credentials for CI and deployments

An agent connected to Scalpels can set up a credential for a project's CI or deployments without the password ever appearing in the conversation. This needs the Admin role in Scalpels.

  1. The agent calls the create_project_credential MCP tool with the project's name, such as its GitHub owner/repo.
  2. Crate returns a single-use code that expires after 10 minutes. It does not return a credential.
  3. The agent redeems the code inside the same command that stores the result, for example:
gh secret set COMPOSER_AUTH --repo acme/storefront \
  --body "$(curl -fsS -X POST https://crate.example.com/exchange/crx_...)"

Redeeming the code issues an installation credential named after the project, with the subject reference crate-project:acme/storefront, and returns it as a COMPOSER_AUTH value. Composer reads the COMPOSER_AUTH environment variable, so the same value works as a GitHub Actions secret or as an environment variable on Laravel Cloud or Forge. The credential belongs to the deployment rather than to the person who asked for it, so it keeps working when they leave. Revoke it from Settings → Installation credentials.

Codes can only be redeemed once. An expired or already used code gets the same 404 as one that never existed.

Rotate and revoke

Each credential in the list has Rotate and Revoke buttons.

  • Rotate issues a replacement and shows its password once. Update everything that uses the old one.
  • Revoke stops the credential working immediately. Composer then gets a 401 from Crate.

Names are labels only. Two credentials can share a name; Crate tells them apart by ID.

Issuing credentials from your own application

The artisan-build/crate-client package includes CrateIssuer, a small client for Crate's /bfc/credentials API. An application of yours can use it to issue, list, rotate and revoke installation credentials, for example to hand a credential to each customer who buys access to your packages. It needs an operator credential for your Crate with the matching credential:mint, credential:read, credential:rotate and credential:revoke abilities, set as CRATE_SERVICE_TOKEN in that application.

The full reference is the integration guide in the Crate repository.