skip to Main Content

Hi guys i hope you’re doing well, i have created a project in next js with sanity. When I run sanity studio then It gives unauthorized error "You are not authorized to access this studio. Maybe you could ask someone to invite you to collaborate on this project?
If you think this is an error, verify that you are signed in with the correct account. You are currently signed in as Raja Ahsan (myemail) through Google."

i have already login in sanity studio but still i got an error.
can anybody help me how to solve this issue.

2

Answers


  1. I had the same issue. In my case it looked like sanity auto logged me in when creating sanity project from the terminal. I did not want that to happen. instead I wanted to be logged out and create the sanity project by choosing a login method (ex: google login) and from that step to choose the login account of my preference. Therefore instead of issuing: npm create sanity@latest

    I found out from sanity documentation (https://www.sanity.io/docs/create-a-sanity-project) under the "trouble installing?" section the following command where it seems firstly a logout is done before creating the sanity project

    npx sanity@latest logout && npm create sanity@latest — –template clean –create-project "Sanity project" –dataset production

    This fixed my issue and I did not get the authentication error.

    hope this helps

    Login or Signup to reply.
  2. I had the same issue and didn’t want to try Ashley’s answer (re-set up my sanity). For me, google auth didn’t work but GitHub auth worked for some reason. (maybe I had earlier logged in, also I checked my admin account setup and it didn’t specify GitHub auth but just the google account I use across).
    I hope this helps for some.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search