Discussion about a 403 error when creating a user in NextAuth Sanity example
13 replies
Last updated: Sep 19, 2022
E
Hello! I am currently working through the "NextAuth Sanity" example on the website. When creating a user, I am receiving a network 403 error "ClientError: the mutation(s) failed: Insufficient permissions; permission "create" required". Is this because I am using the free version which doesn't include "Custom Access Control"? The token I created has editor permissions.
Sep 8, 2022, 7:11 PM
S
No if you use our user roles, you should be fine... It looks like you're not using a
manage.sanity.io and your next as well as sanity setups for the tokens? From what I can gleam this might be the issue
read/writetoken in you client setup for this. Could you check
manage.sanity.io and your next as well as sanity setups for the tokens? From what I can gleam this might be the issue
Sep 8, 2022, 9:57 PM
E
Thank you for your reply! I can confirm that I am using an API Token with editor privileges. I started with the "Next Blog with Comments" template deployed to Vercel. I am able to create comments, so it appears the token is working. Could you suggest another area I might look into?
Sep 10, 2022, 3:23 PM
S
Could you still check which kinds of permissions you set in manage.sanity.io since it seems it has more to do with
rolesthen token themselves...
Sep 11, 2022, 8:12 PM
E
I'm sorry, I don't understand where to look. The 3 default roles appear under the "Access" tab, but they all contain a message that states "This is a system default role and cannot be edited". Is there a different area I should be looking at?
Sep 11, 2022, 9:26 PM
E
I'm sorry, I don't understand where to look. The 3 default roles appear under the "Access" tab, but they all contain a message that states "This is a system default role and cannot be edited". Is there a different area I should be looking at?
Sep 11, 2022, 9:26 PM
S
I really think we need more information from you around your setup or where this error message is occurring and when ... My only blind guess I could do without more was token and roles.Please give us a bit more so we can help.
And ps: you as a free user can use every sanity feature but some extra bling bling and to a certain limit, so you don't have to worry about us limiting your work
š we love every user we have, paying or not, which you might gleem from this community. Who pays gets some extra wonderful things on top, but Sanity is for every purse and everyone ā¤ļø
And ps: you as a free user can use every sanity feature but some extra bling bling and to a certain limit, so you don't have to worry about us limiting your work
š we love every user we have, paying or not, which you might gleem from this community. Who pays gets some extra wonderful things on top, but Sanity is for every purse and everyone ā¤ļø
Sep 11, 2022, 9:32 PM
E
Thank you for your help! I started the project with the Next Blog starter deployed to Vercel, (which is working correctly). I then added the NextAuth Sanity plugin that I found on the Sanity website. I created the Schemas and API routes as directed on the plugin page. The 403 error appears in the console when submitting the form on the signup route. I haven't made any modifications other than adding the plugin, because I wanted to test the Auth functionality first before building the project. Please let me know if I can provide any other information. I appreciate your help.
Sep 11, 2022, 10:19 PM
S
You you please provide your API & form code as well as schemas? This could also be an issue with wrong data construction or so much more š
Sep 11, 2022, 10:39 PM
E
I started again with a fresh install and recreated my steps. I am still getting the same error when submitting the sign up form. I created a public repo with the only commit showing the changes I made to the starter template. I also copied the network error to a text file in the root folder.
https://github.com/edavis211/next-auth-test
I really appreciate you taking the time to look at this. I wasn't expecting this level of help when I started the thread. So I just wanted you I am grateful for any insight you are able to provide.
https://github.com/edavis211/next-auth-test
I really appreciate you taking the time to look at this. I wasn't expecting this level of help when I started the thread. So I just wanted you I am grateful for any insight you are able to provide.
Sep 12, 2022, 1:39 PM
S
And what a wonderful profile pic! š I will have a look
Sep 12, 2022, 4:02 PM
Hey
user Q
! Is it possible that your token is not getting picked up? That's usually the culprit in these situations.Sep 19, 2022, 7:31 PM
E
Yep! The default sanity.js file from the Blog Starter Template was only passing along the token when preview mode was active. I moved it to the default config object and that solved the issue. It is now working perfectly! Thank you for the advice!
Sep 19, 2022, 11:40 PM
Sanityā build remarkable experiences at scale
Sanity is a modern headless CMS that treats content as data to power your digital business. Free to get started, and pay-as-you-go on all plans.