Transfer ownership broke Sanity Studio login - "unknown user" error

18 replies
Last updated: Feb 17, 2022
So a while back I had transferred ownership of my project from a Sanity account that was created with a GitHub login to one that was created directly with Sanity using an email address -- I had run into issues using login providers elsewhere and decided to stop using them across the board.
So I created a throwaway email, used that to create a Sanity organization, transferred the project to that, deleted the old Sanity account, created a new one using the same email just without the GitHub provider, added that user as an admin on the new org, and deleted the throwaway account. Everything looked good -- I did some front end work on the project and I've been able to deploy that using Netlify. I even updated sanity and built and deployed it.

But I didn't actually try to use Sanity Studio to edit content. This is a little personal blog project that I rarely actually update. So today I tried to log in and am getting "unknown user" errors, both locally and on the
_.sanity.studio URL. I can't find anywhere that stores user credentials -- no cookies, local storage, .env files, etc. All I can find is a 404 error for this URL in the console:
https://covwi5zn.api.sanity.io/v2021-06-07/users/me?tag=sanity.studio.users.get-current
Any ideas how to resolve this?
AI Update

This is a tricky situation, but the good news is you eventually got it working! Based on the similar case I found in Sanity's community answers, this is primarily a browser cookie/cached authentication issue that happened because of the complex account transfer process you went through.

Here's what likely happened: When you switched from a GitHub-authenticated account to an email-based account (even with the same email), Sanity treats these as completely different user identities. During your transfer process, some stale authentication data got cached in Chrome that was pointing to your old GitHub-based identity, which no longer exists. This is why you were seeing the 404 error for https://covwi5zn.api.sanity.io/v2021-06-07/users/me — the browser was sending old credentials for a user that doesn't have access to the project anymore.

How to fix the "unknown user" error:

1. Deep clean your browser data

As you discovered, the standard "clear cookies" isn't always enough. Chrome (and other browsers) can cache authentication data in places that don't show up in DevTools. Here's what to do:

  • Go to Chrome Settings → Privacy and Security → Clear browsing data
  • Select "All time" as the time range
  • Check: Cookies, Cached images and files, and Site settings
  • Important: Also search for "sanity" in the site data section and manually delete anything related to sanity.io or sanity.studio

2. Check your project access

Log into sanity.io/manage with your current email/password account and verify:

  • You can see the project with ID covwi5zn
  • Your current user account is listed as a member with Admin permissions
  • If you can't see the project or aren't listed as a member, that's your root issue

3. If you're locked out completely

If your current account doesn't have access to the project in Manage, you'll need to contact Sanity support. Explain the account transfer sequence you went through. They can verify your ownership (via your Netlify deployments and local project files) and add your current account identity as an admin.

4. Try a different browser temporarily

As you found, Firefox worked when Chrome didn't. This confirms it's browser-specific cached data causing the issue.

Why this happened:

Sanity treats each authentication method as a separate user identity. Your user@example.com via GitHub and user@example.com via email/password are two completely different users in Sanity's system. When you transferred the project between accounts and deleted the intermediary accounts, you likely ended up with a project where the admin user ID doesn't match your current authenticated user ID.

The cookie/authentication issue is a known problem that Sanity has been working on, particularly related to third-party cookie handling in modern browsers.

Pro tip: For future reference, if you need to switch authentication methods, it's safer to add the new account as an admin first, verify access, then remove the old account — rather than doing transfers through intermediary accounts. This avoids getting into situations where you're locked out due to mismatched user identities.

Show original thread
18 replies
Hi User. Are you able to sign into Manage ? If so, please could check whether
covwi5zn
is the correct id for your project?
Yes I'm able to log in there, and that's the right ID. This is my sanity.json from the studio project:
{
  "root": true,
  "project": {
    "name": "tcblog"
  },
  "api": {
    "projectId": "covwi5zn",
    "dataset": "production"
  },
  "plugins": [
    "@sanity/base",
    "@sanity/components",
    "@sanity/default-layout",
    "@sanity/default-login",
    "@sanity/desk-tool"
  ],
  "env": {
    "development": {
      "plugins": [
        "@sanity/vision"
      ]
    }
  },
  "parts": [
    {
      "name": "part:@sanity/base/schema",
      "path": "./schemas/schema.js"
    }
  ]
}

And this is the URL for the project's page in Sanity studio -- shows the ID there too:
https://www.sanity.io/organizations/oCrgdkmXp/project/covwi5zn
Thanks for checking that. Please can I ask you to visit this URL in the same browser you are using for Sanity Studio, and DM me the response body.
Done. I'm guessing this is somehow tied to the fact that the new account uses the same email as the old GitHub login provider account.
I think there's definitely some kind of mix up. I can see the admin user of your project has a different id to the id you are currently authenticated as.
Just to double check; when you signed in, did you select the "E-mail / password" option?
In the Manage area, yes I get a prompt and choose Email/password".
When trying to use the studio I don't even get the option to log in, it just goes straight to the "user unknown" error. That's why I thought there must be a cookie or something, but I cleared everything, tried incognito, etc.
Ah wait, I can log in in a different browser (I was using Chrome, but it works in Firefox). Still doesn't prompt me to login though.
And I just noticed that in Chrome incognito I get an error about cookies. It says "WE COULDN'T LOG YOU IN
Your browser wouldn't accept our cookie." And there is a "TRY AGAIN" button. If I click that it opens a popup, it says "*Your browser wouldn't accept our cookie*
Press the button below to try to resolve the problem." and there's a CONTNUE button, I click that and it says "*Thanks, that should do it!*
If you still have problems, make sure your browser doesn't block all third party cookies, or try another browser."
Ah wait, I can log in in a different browser (I was using Chrome, but it works in Firefox). Still doesn't prompt me to login though.
And I just noticed that in Chrome incognito I get an error about cookies. It says "WE COULDN'T LOG YOU IN
Your browser wouldn't accept our cookie." And there is a "TRY AGAIN" button. If I click that it opens a popup, it says "*Your browser wouldn't accept our cookie*
Press the button below to try to resolve the problem." and there's a CONTNUE button, I click that and it says "*Thanks, that should do it!*
If you still have problems, make sure your browser doesn't block all third party cookies, or try another browser."
I guess that
I guess that
I guess that's because it's incognito. Still doesn't explain why even after clearing all cookies, local storage, etc. the main non-incognito window doesn't work. It's like something from an old login session is stuck somewhere in the browser.
The cookie error is unfortunately a known issue. We're working to provided a fix as soon as we can. It occurs when the web browser declines third-party cookies for one reason or another... understandably, this mode is the default for a lot of folks today!
The Chrome issue is certainly strange! After you have cleared all of your saved browser data, what do you get back from this URL ?
So I managed to get it working. I had to use Chrome's settings to search all saved browser data and deleted anything mentioning "sanity". Unfortunately I don't know what specifically fixed it, but it was some saved data that wasn't showing up in the dev tools either on my local dev instance or in the Sanity-hosted studio. I guess it is probably a 3rd party cookie but I thought those showed in the dev tools.
But to answer your question, I get an empty object at that URL:
So I managed to get it working. I had to use Chrome's settings to search all saved browser data and deleted anything mentioning "sanity". Unfortunately I don't know what specifically fixed it, but it was some saved data that wasn't showing up in the dev tools either on my local dev instance or in the Sanity-hosted studio. I guess it is probably a 3rd party cookie but I thought those showed in the dev tools.
But to answer your question, I get an empty object at that URL:
I'm glad that addressed the issue! I'll keep an eye out for anything similar happening in Chrome; it'd be interesting to know which data it had squirrelled away.
Thank you for sharing the response you get. An empty object should mean you are signed out.
I'm glad that addressed the issue! I'll keep an eye out for anything similar happening in Chrome; it'd be interesting to know which data it had squirrelled away.
Thank you for sharing the response you get. An empty object should mean you are signed out.

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?