adrianhajdin / project_graphql_blog

With featured and recent posts, categories. full markdown articles, author information, comments, and much more, this fully responsive CMS Blog App is the best Blog Application that you can currently find on YouTube. And what's best of all is that you and your clients can manage the blog from a dedicated Content Management System.
https://jsmastery.pro
1.47k stars 347 forks source link

ClientError: Mutation failed due to permission errors #48

Open khanhthanhdev opened 2 years ago

khanhthanhdev commented 2 years ago

'''error - ClientError: Mutation failed due to permission errors: {"response":{"errors":[{"message":"Mutation failed due to permission errors","extensions":{"code":"403","failedActions":[{"action":"create","model":"Comment","stage":"DRAFT"},{"action":"update","model":"Post","stage":"DRAFT"}]}}],"data":null,"extensions":{"requestId":"cl87cg1f45rwc0ezs00jhmkep"},"status":403,"headers":{}},"request":{"query":"\n mutation CreateComment($name: String!, $email: String!, $comment: String!, $slug: String!) {\n createComment(data: {name: $name, email: $email, comment: $comment, post: {connect: {slug: $slug}}}) { id }\n }\n ","variables":{"name":"Trần Khánh Thành","email":"thanhkt27507@gmail.com","comment":"test comment","slug":"twg-la-gi"}}} at D:\test-blog\project_graphql_blog\node_modules\graphql-request\dist\index.js:254:31 at step (D:\test-blog\project_graphql_blog\node_modules\graphql-request\dist\index.js:63:23) at Object.next (D:\test-blog\project_graphql_blog\node_modules\graphql-request\dist\index.js:44:53) at fulfilled (D:\test-blog\project_graphql_blog\node_modules\graphql-request\dist\index.js:35:58)'''

I clone project and follow the video at 2:47:00 . How to fix this error. I'm trying to fix this bug

ariyannandi commented 1 year ago

You need to give all the required permissions to your CMS token. It fixed the issue for me. Go to settings > Permanent Auth Tokens and then edit the token you are using and then give the permissions. Hope it helps.