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, or Yarn 1 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 npm, pnpm, or Yarn 1 locally

Other package clients cannot read the LPM CLI keychain session. They read a token from the .npmrc file of the project. lpm setup local writes this file for you. You can also write the file by hand.

lpm setup local needs the session from lpm login. It does not work with a token in LPM_TOKEN. If a project must install @lpm.dev/* packages with npm, pnpm, or Yarn 1, run this command in the project:

lpm setup local

The command creates a read-only token and writes these settings to the project .npmrc:

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

Only packages in the @lpm.dev scope use LPM.dev Registry. The command gives .npmrc owner-only file permissions and adds .npmrc to .gitignore. If Git tracks .npmrc, the command stops before it writes the token.

Bun cannot use this file. The registry URL in the file has no trailing slash, so Bun drops the /api/registry path. To use Bun, write the file by hand. Yarn 2 and later do not read .npmrc.

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. After that, lpm setup local cannot replace it. Before you run the command again, delete the lines from # LPM Registry to # End LPM Registry in .npmrc.

Write .npmrc by hand

lpm setup local is optional. You can write .npmrc yourself with a token that you create in the dashboard. With this file, the package client reads the token from the LPM_TOKEN environment variable.

  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.
  6. Set the LPM_TOKEN environment variable to the token where the package client runs.
  7. Add these lines to the .npmrc file in the project root:
@lpm.dev:registry=https://lpm.dev/api/registry/
//lpm.dev/api/registry/:_authToken=${LPM_TOKEN}

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 can use this file. Each of them replaces ${LPM_TOKEN} with the value of the environment variable. The file contains no token, so you can commit it.

If you commit this file, lpm setup local and lpm setup ci npmrc do not work in the project. Both commands refuse to write to a .npmrc that Git tracks.

Bun can also read the scope from bunfig.toml:

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

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 Write .npmrc by hand. Store the token as the LPM_TOKEN secret in the CI provider. In the CI job, run this command before the package client installs:

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.

You can also commit the file from Write .npmrc by hand. The CI job then needs only the LPM_TOKEN secret.

LPM CLI reads LPM_TOKEN itself and does not need .npmrc. CI/CD integration has workflow examples for LPM CLI and for npm-compatible 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 publishes and other registry changes for the organization from that member.

See also