Following the 4 minute YouTube Prisma demo, Setup ...
# prisma-whats-new
s
Following the 4 minute YouTube Prisma demo, Setup TypeScript Advanced GraphQL Server when I tried mutation{ createDraft(title:"my draft", text:"yada yada"){ id } } Got back error of "message": "Not authorized", I even signed in and logged in using another tab and got a token How do I become authorized to create a draft? Even tried - disableAuth: true in prisma.yml and get the same error
1
l
set the disableAuth: true, remove the secret, make a trivial schema change, and redeploy.
There's a bug when all that changes is the disableAuth
n
that error is actually an error returned by the application itself, if no valid
Authorization
header is provided. Check this line: https://github.com/graphql-boilerplates/node-graphql-server/blob/master/advanced/src/resolvers/Mutation/post.js#L5
you need to use the
signup
mutation to obtain a valid token first 🙂
s
Thanks for quick answers @nilan I signed in on another tab in graphical and got a token. I the used another tab to createDraft and get the error.
n
did you provide the auth header?
s
no -- noob here how do I do that?
n
are you using the GraphQL Playground?
s
yes
n
there is a "HTTP HEADERS" button, click it to open the panel to set HTTP headers
then enter this JSON object:
Copy code
{
  "Authorization": "Bearer <token>"
}
where
<token>
is your token.
s
looking for httpheaders button?
o I see it thanks!
n
🙌