
Grab your gear: The official Sanity swag store
Read Grab your gear: The official Sanity swag storeGood news - you don't need to be logged in to run npm create sanity@latest! The "unauthorized" error you're seeing is likely happening at a different step in the process.
Here's what's actually happening: npm create sanity@latest (or npx sanity@latest init) will download and run the @sanity/cli package temporarily without installing it globally. During the initialization process, the CLI will prompt you to log in to Sanity through your browser. This is when authentication happens - not before the package is downloaded.
The typical flow looks like this:
npm create sanity@latest -ysanity loginIf you're getting an "unauthorized" error immediately, a few things to try:
Option 1: Let the wizard prompt you naturally
Remove the -y flag and let the setup wizard guide you through the login:
npm create sanity@latestOption 2: Pre-authenticate with the CLI
If you want to log in first, install the Sanity CLI globally and authenticate:
npm install -g sanity@latest
sanity loginThen run your project creation command.
Option 3: Use npx without auto-yes
The -y flag might be skipping important prompts:
npx sanity@latest initThe Sanity CLI documentation shows that authentication is handled during the initialization wizard, not as a prerequisite for downloading the package. The sanity login command opens your browser to authenticate with Sanity's servers, which happens after the CLI package is already running on your machine.
If you're still seeing issues, it might be an npm registry problem rather than an authentication issue with Sanity itself. Make sure you can access npm packages normally, and check if you're behind a corporate proxy that might be blocking the download.
Sanity is the developer-first content operating system that gives you complete control. Schema-as-code, GROQ queries, and real-time APIs mean no more workarounds or waiting for deployments. Free to start, scale as you grow.
Content operations
Content backend


The only platform powering content operations
By Industry


Tecovas strengthens their customer connections
Build and Share

Grab your gear: The official Sanity swag store
Read Grab your gear: The official Sanity swag store