Skip to content
Back to Knowledge Base

Log in to Nx Cloud from the CLI

Log in so Nx Cloud knows you're a member of the workspace and gives you the access set for logged-in members. CI runs use CI access tokens instead.

  1. Run npx nx login from your workspace. It shows a code and opens Nx Cloud in your browser.
  2. On the Nx Cloud CLI login page, check that the code matches the one in your terminal and select Approve.

The Nx Cloud CLI login page showing a code to compare with the terminal, with Approve and Deny buttons

If no browser opens, open the URL the terminal printed.

Terminal window
npx nx login --status

The command shows the account you're logged in as.

In Nx Cloud, open Personal settings from the account menu and select Access tokens. The CLI sessions card lists each login.

The CLI sessions card listing one signed-in device, with Sign out and Sign out of all CLI sessions

Sign out ends one session, and Sign out of all CLI sessions ends every one. A device you sign out needs nx login again.

Terminal window
npx nx logout

With logins for several Nx Cloud instances, see nx-cloud logout.

Set both access levels in your workspace's access control settings.

The Default access level setting covers anyone who isn't logged in, or isn't a member of the workspace's Nx Cloud organization. It starts at read-write. Lower it to read-only or none for any repository that people outside your team can see, such as an open source repository or one that's visible across your organization but only editable by one team.

The Logged in users setting covers workspace members who ran nx login. Set it to read-only, read-write, or no-cache.

Use a personal access token only where you can't log in: scripts that call the Public API without the Nx Cloud CLI, and CI jobs that publish conformance rules. Other CI steps use a CI access token. Create a personal access token under Personal settings > Access tokens.

Last updated: