Docs menuAuthentication

Authenticate with LPM.dev Registry

LPM CLI sessions, local .npmrc tokens, and CI credentials have different uses. Start with lpm login. Add another credential only if a different package client or a CI job needs one.

CommandUse it for
lpm loginSign LPM CLI in to LPM.dev Registry on this machine.
lpm setup localGive npm, pnpm, Yarn 1, or Bun read-only access to @lpm.dev/* in a local project.
lpm setup ci npmrcGenerate .npmrc for a CI job that supplies LPM_TOKEN.
lpm logoutRemove the stored LPM.dev Registry session from this machine.
lpm logout --revokeRevoke the CLI session on LPM.dev Registry, then remove it from this machine.

Sign in LPM CLI

lpm login
lpm whoami

lpm login opens the browser to sign in. Before LPM.dev Registry authorizes the device, the browser asks for your password, authenticator code, or passkey again. This verification works only once, for the current browser session and this login request. LPM CLI stores the session in the operating-system keychain. If no keychain is available, LPM CLI stores the session in an encrypted local file.

LPM CLI uses this session for commands such as these:

lpm install @lpm.dev/acme.design-system
lpm publish

You do not need .npmrc for these LPM CLI commands.

Use other package managers

Other package clients cannot read the LPM CLI keychain session. To install @lpm.dev/* packages, they need two settings: the registry of the @lpm.dev scope and a read token. You do not need LPM CLI for these settings.

Put the registry in a project file and commit that file. Put the token in your user configuration, outside the project. A Free package needs only the registry.

Only packages in the @lpm.dev scope use LPM.dev Registry. Other packages keep their registries.

Create a read token

  1. Open the Tokens tab in your personal settings.
  2. Select "Generate token".
  3. For "Scope", select "Read (download packages)". Select an expiration of 7, 30, 60, or 90 days.
  4. Select "Generate token" in the dialog. Then complete the identity verification.
  5. Copy the token. The dashboard shows it only once.

Organization owners and admins can create an organization token instead. They use the "Tokens" tab in the organization settings.

npm, pnpm, Yarn 1, and Bun

These package clients read .npmrc files.

  1. Add this line to the .npmrc file in the project root:
@lpm.dev:registry=https://lpm.dev/api/registry/
  1. Commit the project .npmrc. It contains no token.
  2. Add this line to the .npmrc file in your home directory. Replace lpm_... with your read token:
//lpm.dev/api/registry/:_authToken=lpm_...

Keep the trailing slash in the registry URL. Without it, Bun removes /api/registry from the URL and cannot find the packages.

Keep the token line out of the project .npmrc. Since pnpm 10.34.2 and 11.5.3, pnpm does not replace environment variables in a token line of the project .npmrc. It ignores a ${LPM_TOKEN} line there and prints a warning.

Bun can also read the registry and the token from bunfig.toml in the project. Bun replaces $LPM_TOKEN with the value of the environment variable:

[install.scopes]
"@lpm.dev" = { url = "https://lpm.dev/api/registry/", token = "$LPM_TOKEN" }

Yarn 2 and later

Yarn 2 and later do not read .npmrc. They read the registry from .yarnrc.yml.

  1. Add these lines to the .yarnrc.yml file in the project root:
npmScopes:
  lpm.dev:
    npmRegistryServer: "https://lpm.dev/api/registry/"
  1. Commit .yarnrc.yml. It contains no token.
  2. Store your read token in your home directory. Replace lpm_... with the token:
yarn config set --home 'npmScopes["lpm.dev"].npmAuthToken' lpm_...

The command writes the token to the .yarnrc.yml file in your home directory. Yarn uses this token with the registry from the project file.

Let LPM CLI write .npmrc

If you use LPM CLI, lpm setup local creates a read token for you. It writes the registry line and the token line to the project .npmrc.

lpm setup local needs the session from lpm login. It does not work with a token in LPM_TOKEN. Run this command in the project:

lpm setup local

The command writes these settings to the project .npmrc:

@lpm.dev:registry=https://lpm.dev/api/registry/
//lpm.dev/api/registry/:_authToken=lpm_...

npm, pnpm, Yarn 1, and Bun can use this file. Yarn 2 and later do not read it.

The command gives .npmrc owner-only file permissions and adds .npmrc to .gitignore.

If Git tracks the project .npmrc, LPM CLI 0.87.0 and later do not change that file. They write the registry line and the token line to the .npmrc file in your home directory instead. If NPM_CONFIG_USERCONFIG names another file, they write to that file. Every project on the machine then uses this token. If the project .npmrc has no registry line, or its URL has no trailing slash, the command says what to change.

The command stops before it creates a token if the tracked .npmrc has a token line for LPM.dev Registry. It also stops if the .npmrc file in your home directory has such a line that LPM CLI did not write. Remove that line first. If the line in the tracked file holds a token, revoke that token too. LPM CLI setup lists every case where the command stops.

LPM CLI 0.86.0 and earlier stop whenever Git tracks .npmrc. With these releases, put the token line in your home directory as in npm, pnpm, Yarn 1, and Bun.

LPM CLI 0.84.0 and earlier wrote the registry URL without the trailing slash. If Bun cannot find a package, run lpm setup local again with LPM CLI 0.85.0 or later.

By default, the token is valid for 30 days. To set a different lifetime from 1 to 90 days, add --days:

lpm setup local --days 7

Do not commit the generated .npmrc. It contains the token.

If the token expires or is exposed, run lpm setup local again. The command revokes the old token and writes a new one.

You can also revoke the token in the Tokens tab of your personal settings. The next lpm setup local run then creates a new token and says that the old one is no longer active. LPM CLI 0.84.0 and earlier stop instead. With these releases, first delete the lines from # LPM Registry to # End LPM Registry in .npmrc.

npm commands and registry errors

LPM.dev Registry serves installs, npm publish, npm deprecate, and npm unpublish for @lpm.dev/* packages. It answers these npm commands differently:

CommandWhat LPM.dev Registry does
npm login, npm adduserRefuses with HTTP 501. Sign in with lpm login, or put a token in .npmrc.
npm logoutEnds the session if the token comes from lpm login. A token from the dashboard stays valid until you revoke it in Tokens. npm removes the token from .npmrc in both cases.
npm dist-tag lsLists the dist-tags. The only tag is latest, the newest installable version.
npm dist-tag add, npm dist-tag rmRefuses with HTTP 405. LPM.dev Registry moves latest when you publish.
npm token, npm profile, npm access, npm owner, npm hookRefuses with HTTP 404. Manage tokens, your account, and access in the dashboard.
npm auditRefuses with HTTP 404. Run lpm audit, or run npm audit against registry.npmjs.org.

When LPM.dev Registry refuses a request, the JSON response has two fields. error is one sentence that says what happened and what to do. code is a stable name such as PACKAGE_NOT_FOUND, TOKEN_EXPIRED, or LICENSE_REQUIRED. npm, Yarn, and Bun print error after the HTTP status. pnpm prints only the status. If the registry itself fails, error includes a request ID that starts with req_. Give that ID to support.

A private package that a token cannot read gets the same answer as a package that does not exist.

Authenticate CI

For package installs in CI, use a read token. Create the token as in Create a read token. Store the token as the LPM_TOKEN secret in the CI provider. LPM CLI reads LPM_TOKEN itself and does not need .npmrc.

For npm, pnpm, Yarn 1, and Bun, commit the project .npmrc from npm, pnpm, Yarn 1, and Bun. In the CI job, store the token in npm's user configuration before the install:

npm config set "//lpm.dev/api/registry/:_authToken" "$LPM_TOKEN"

The command writes the token line to ~/.npmrc with owner-only permissions. If the job sets NPM_CONFIG_USERCONFIG, as actions/setup-node does with registry-url, the command writes to that file instead. npm, pnpm, and Yarn 1 read it there. Bun reads only ~/.npmrc, so a Bun job in that case uses bunfig.toml instead. Do not upload or cache the file.

For Yarn 2 and later, commit .yarnrc.yml from Yarn 2 and later. In the CI job, store the token before the install:

yarn config set --home 'npmScopes["lpm.dev"].npmAuthToken' "$LPM_TOKEN"

If the job installs LPM CLI, lpm setup ci npmrc can write the project .npmrc instead:

lpm setup ci npmrc

The command reads the token from LPM_TOKEN. Without LPM_TOKEN, it uses the stored LPM CLI session. If it finds neither, it stops. The command writes the token itself into .npmrc:

//lpm.dev/api/registry/:_authToken=lpm_...
@lpm.dev:registry=https://lpm.dev/api/registry/

The command gives .npmrc owner-only file permissions. It keeps .npmrc out of Git with the .git/info/exclude file of the repository, so no tracked file changes. Do not upload .npmrc as a build artifact. It contains the token.

If Git tracks .npmrc, LPM CLI 0.87.0 and later write the token to npm's user configuration instead, as the npm config set command does. LPM CLI 0.86.0 and earlier stop.

CI/CD integration has workflow examples for LPM CLI and for the other package clients.

Sign out

Clear only the credentials stored on this machine:

lpm logout

lpm logout cannot unset LPM_TOKEN. If LPM_TOKEN is set, unset it in that shell or CI environment.

If you leave a shared machine or think that a credential is exposed, revoke the session on LPM.dev Registry:

lpm logout --revoke

lpm logout --revoke ends the CLI session and its refresh token on LPM.dev Registry. It also revokes every environment dashboard pairing of your account. Then it removes the credentials from this machine. It does not revoke tokens or the sessions on your other devices.

To review and revoke your other sessions, open Security settings. To revoke tokens, open Tokens.

Session recovery

LPM CLI renews a saved session automatically. If the session is revoked, run lpm login again.

If LPM_TOKEN is set, LPM CLI uses it instead of your saved login. If LPM.dev Registry rejects LPM_TOKEN, replace the token or unset LPM_TOKEN. LPM CLI keeps your saved credentials. With --json, the error code is env_token_rejected, and the next steps give the same advice.

Security settings show your active sessions each time the page loads. "Sign out from all devices" revokes your browser and CLI sessions. It does not revoke tokens. Revoke them in the Tokens tab.

If you revoke one of your other sessions, the dashboard asks for identity verification. You stay signed in, and the other session ends. "Sign out from all devices" does not ask. It signs you out too, so a stolen session cannot use it to stay signed in. It also works if you lost your passkey or authenticator. If you revoke a token, the dashboard does not ask, because no session ends.

After a browser sign-out or an account change, open tabs reload. If a browser session expires, sign in again. The browser then returns to the page that you requested.

Dashboard access to encrypted environments

Environment dashboard pairing is separate from LPM.dev Registry authentication. To pair a browser, run this command with the code that the dashboard shows:

lpm env pair <CODE>

Pairing needs the session from lpm login. A token, such as one in LPM_TOKEN, does not work. Dashboard pairing explains the end-to-end encrypted pairing flow.

Sign in with a second factor

If your account has a passkey or an authenticator app, sign-in has a second step. This step comes after your password or connected provider. It starts with your passkey if you have one. Under "Having problems?", it lists the other method that your account has. A password never replaces an enrolled passkey or authenticator.

If you add a passkey, it counts as the second factor of the current session. That session stays signed in.

Sensitive dashboard actions

Sensitive dashboard actions ask for the same verification. It appears in a dialog with the title "Confirm access" or "Verify your identity". These actions include:

  • deleting your account, an organization, or a package
  • creating tokens
  • changing security settings
  • inviting members and changing their roles
  • granting CI access to an env project
  • changing webhooks and payout settings
  • pairing a browser with the environment dashboard

The verification shows the account that you are signed in as. It starts with a method from your enrolled credentials:

Account credentialsDefault methodAlternative
Passkey and authenticatorPasskeyAuthenticator code
Passkey onlyPasskeyNone
Authenticator onlyAuthenticator codeNone
Password onlyAccount passwordNone
Connected provider onlySign in again with the providerNone

If you have both a passkey and an authenticator, "Having problems?" offers the method that the verification did not start with. Each time the verification opens, it starts with your passkey again. If you cancel the passkey prompt, the current method stays selected. A password cannot replace an enrolled passkey or authenticator.

Each verification authorizes one action. The next sensitive action asks again. A verification works only in the current browser session and only for that action. Often it is also limited to one organization, package, or env project. If you do not use it within five minutes, it expires. Some actions make two requests, such as adding a passkey or setting up an authenticator. One verification covers both requests.

Some actions also ask you to type a name or to accept a warning. For these actions, the verification appears in the same dialog. A typed name records your intent. It does not replace identity verification.

Account recovery and authenticator enrollment have their own verification steps. A password change also needs the current password. For a password-only account, the current password is the identity verification. The dashboard does not ask for the password a second time.

Confirm registry changes with your second factor

If your account has a passkey or an authenticator app, LPM.dev Registry asks for it before each of these changes made with a token:

  • publishing a version
  • unpublishing a version, or deprecating or undeprecating one or every version
  • rotating a token that can publish or write to the remote cache

If an organization requires two-factor authentication, LPM.dev Registry also asks for it when you rotate any token of the organization. Trusted publishing needs no second factor. The CI provider takes the place of the second factor.

Approve CLI requests in the browser

If LPM CLI needs your second factor, it can open a browser page instead of asking for a code. This applies to the registry changes above and to environment sharing-key changes. The page shows the requested change and who requested it. For a CLI session, the page shows your terminal and its device. For a token without a CLI session, such as a token in LPM_TOKEN, the page shows the token name. "Approve" asks for your passkey or authenticator code. "Deny" stops the request.

An approval works only for that one request, and only from the terminal session or token that requested it. It expires after 10 minutes. If your account has an authenticator app, you can send a code from the terminal instead.

A passkey works only in the browser. If your account has only a passkey, you need an LPM CLI version that offers the browser approval. LPM.dev Registry refuses the change from an older version. To update LPM CLI, run lpm self-update.

npm publish, npm unpublish, npm deprecate, and npm undeprecate use the same approval. In a terminal, npm 9 or later opens the approval page. After you approve, npm makes the change. If your account has an authenticator app, you can pass the code with --otp=<code> instead. For example: npm publish --otp=<code>.

Organizations that require two-factor authentication

An organization can require two-factor authentication. A passkey or an authenticator app meets the requirement. Until a member adds one in Security settings, the dashboard does not open the pages of the organization. LPM.dev Registry also refuses that member's tokens for the organization. They cannot read its private, Pool, or Marketplace packages, publish, or make other registry changes. An organization token is held to the same rule through the member who created it. An organization that requires a connected sign-in provider applies the same refusals until the member connects that provider.

The rule also covers what the organization pays for on a member's behalf: its Pool seats, its licenses for other publishers' Marketplace packages, and the license seats it assigns. Until the member meets the requirement, their tokens cannot install packages through those, and the refusal names the organization. The public listing of such a package stays readable. A member's own Pool plan and their own purchases are not affected. Neither is a seat from another organization whose requirements the member meets.

See also