Sanity Deploy "You do not have access to the project" Error Despite Correct Login

46 replies
Last updated: Nov 29, 2025
I am getting "You do not have access to the project with ID '...'. You may need to login again with sanity login." when I try and
sanity deploy
from my studio directory in Terminal. Reading the docs for this error is not helpful , I am logged into that same account, it's my only project, and the project ID is exactly the same. What do I do?
AI Update

This is a frustrating authentication issue that comes up occasionally! The "You do not have access to the project" error during sanity deploy is almost always caused by stale or corrupted authentication tokens in the Sanity CLI, even when you appear to be logged in.

Here's what to try:

1. Force a fresh login

Run these commands in order:

sanity logout
sanity login

This clears your existing auth token and creates a new one. After logging back in, try sanity deploy again.

2. Check your auth token location

The Sanity CLI stores authentication tokens in a config file. On macOS/Linux, this is typically at ~/.config/sanity/config.json. Sometimes this file gets corrupted or contains tokens from old sessions.

You can manually delete this file and log in again:

rm ~/.config/sanity/config.json
sanity login

On Windows, the config is usually stored in %USERPROFILE%\.config\sanity\config.json.

3. Verify your project ID

Double-check that the projectId in your sanity.config.ts (or sanity.json for older projects) exactly matches your actual project ID in manage.sanity.io. Even a single character difference will cause this error.

4. Check project permissions

Go to manage.sanity.io, select your project, and verify under Settings → Members that your account actually has admin or deploy permissions. If you were recently added to a project by someone else, you might not have the right role.

5. Try with an explicit auth token

As mentioned in the sanity deploy documentation, you can bypass the stored credentials by using an environment variable:

SANITY_AUTH_TOKEN=your-token-here sanity deploy

You can generate a token at manage.sanity.io under your project's Settings → API → Tokens.

Why this happens:

The CLI authentication can get out of sync if you've logged in from multiple machines, changed your Sanity password, or if there were network issues during a previous login. The logout/login cycle forces the CLI to request a fresh token from Sanity's servers.

In 99% of cases, the sanity logoutsanity login sequence fixes this immediately. If it still doesn't work after that, there's likely a permissions issue with your Sanity account on that specific project.

Show original thread
46 replies

Sanity – Build the way you think, not the way your CMS thinks

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.

Was this answer helpful?