---
title: "Authentication & Tokens"
description: "Documentation for the vlt client and the vlt registry."
url: "https://docs.vlt.io/registry/tokens"
image: "https://docs.vlt.io/og/registry/tokens"
lang: "en"
---

# Authentication & Tokens

Requests to the vlt registry are authenticated with a bearer token. There are three exceptions: the endpoints used by the login flow, reads of [public packages](https://docs.vlt.io/registry/publishing.md#package-visibility), and reads through the open [public npm mirror](https://docs.vlt.io/registry/public-mirror.md) at `https://registry.vlt.io/upstream/npm/`, which needs no token and ignores any token you send. Unauthenticated use of that mirror is limited; for unlimited usage, use your account's `npm` mirror. Tokens belong to an **account** — one token works for both of the account's registries (`main` and `npm`).

## Log in from the CLI

The registry supports the npm web login flow. Point your client at your registry and log in:

```bash title="Terminal"
$ vlt login --registry=https://registry.vlt.io/acme/main/
```

Your browser opens vlt.io to confirm the login, and the client stores the resulting token in the vlt keychain. npm works the same way:

```bash title="Terminal"
$ npm login --auth-type=web --registry=https://registry.vlt.io/acme/main/
```

See [Authentication](https://docs.vlt.io/client/auth.md) for everything the vlt client supports around credential storage and identities.

## Personal and service tokens

There are two kinds of tokens:

- **Personal tokens** are bound to your user. Writes made with a personal token are subject to the account's two-factor (OTP) requirement. Logging in from the CLI mints a personal token scoped to `package:read`, `package:publish` and `package:write`, plus `package:trust` for owners and admins, which [`npm trust`](https://docs.vlt.io/registry/publishing/trusted-publishing.md#with-npm-trust) needs.
- **Service tokens** belong to the account rather than a person. They are meant for CI and automation, and they are not subject to OTP prompts. Creating service tokens requires an owner or admin role.

Tokens start with the `vlt_1_` prefix. The registry stores only a hash of each token, so the full value is shown once at creation — copy it then.

## Privileges and expiry

Every token carries a set of privileges, such as `package:read`, `package:write`, `token:read`, or `member:write`. A request succeeds only if **both** the token and the requesting user's account role grant the privilege, so a read-only token stays read-only no matter who uses it, and a token can never grant more than its creator's own role allows.

For example, a CI token that only installs packages needs just `package:read`; a publish token needs `package:write` as well.

Tokens can optionally be given an expiration date, after which they stop working. Expired and revoked tokens are rejected on every request.

## Managing tokens

Create, inspect, and revoke tokens from your account's token settings in the [dashboard](https://www.vlt.io/). Members can create and revoke their own personal tokens; owners and admins can also manage service tokens.

**note**

The dashboard is the easiest place to manage tokens, but the npm `token` subcommands (`npm token list`, `npm token create`) also work against your registry. `pnpm token` does not — pnpm reports `Not implemented in pnpm. Use the npm CLI directly`.

## Using tokens in CI

Provide a token through the environment rather than a config file. The portable form is `VLT_TOKEN` alongside `VLT_REGISTRY`:

```bash title="Terminal"
VLT_REGISTRY=https://registry.vlt.io/acme/main/ \
VLT_TOKEN="<service token>" vlt install
```

To authenticate more than one registry, set a per-registry `VLT_TOKEN_*` variable for each configured registry, named after its URL with the trailing `/` dropped and each run of non-alphanumeric characters replaced by `_`:

```bash title="Terminal"
VLT_TOKEN_https_registry_vlt_io_acme_npm="<service token>" \
VLT_TOKEN_https_registry_vlt_io_acme_main="<service token>" \
vlt install
```

This applies to `registries` and `scoped-registries` alike.

See [Authentication — CI](https://docs.vlt.io/client/auth.md#ci-and-other-headless-environments) for details, and [CI & automation](https://docs.vlt.io/registry/publishing/ci.md) for the publish workflow.

With npm, use the standard `.npmrc` auth entry, ideally referencing an environment variable:

```ini title=".npmrc"
@acme:registry=https://registry.vlt.io/acme/main/
//registry.vlt.io/acme/main/:_authToken=${NPM_TOKEN}
```

That form works for npm — an unset variable is sent as the literal string, so a missing secret fails like a bad token. **pnpm ignores `${...}` in a project `.npmrc`**; see [pnpm in CI](https://docs.vlt.io/registry/publishing/ci.md#pnpm-needs-a-different-approach). Never commit a literal token, or have CI write one into the project `.npmrc`. For which tool reads what, Vercel and agent sandboxes, see [CI & automation](https://docs.vlt.io/registry/publishing/ci.md#who-reads-what).

## Removing credentials

- `vlt logout --registry=...` removes the token from your keychain, under every registry key holding it (e.g. both `npm` and `main`). Revoke the token itself in the dashboard.
- `vlt token rm` removes a token from your local keychain only.
- Revoking a token in the dashboard invalidates it everywhere, immediately.
