title: Why am I getting an "invalid token" error in the GraphQL playground/IDE?
body: <p>I'm using graphql-yoga server, Express, Node.js, Prisma client and Prisma server. And trying to do a post mutation to a GraphQL server using the GraphQL playground. However, I'm getting a persistent error "invalid token" which seems to span from my <code>getUSerId</code> helper function that's called on most Mutation field resolver functions.</p>
  
  <p>Here is a code snippet of the error</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>{
    "data": null,
    "errors": [
      {
        "message": "invalid token",
        "locations": [
          {
            "line": 2,
            "column": 3
          }
        ],
        "path": [
          "post"
        ]
      }
    ]
  }</code></pre>
  </div>
  </div>
  </p>
  
  <p>Here is the code to my resolver function in utils.js</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>const jwt = require("jsonwebtoken");
  const APP_SECRET = "GraphQL-is-aw3some";
  
  function getUserId(context) {
    const Authorization = context.request.get("Authorization");
  
    if (Authorization) {
      const token = Authorization.replace("Bearer", "");
      const { userId } = jwt.verify(token, APP_SECRET);
      return userId;
    }
    throw new Error("Not Authenticated");
  }
  
  module.exports = {
    APP_SECRET,
    getUserId
  };</code></pre>
  </div>
  </div>
  </p>
  
  <p>Here is code for my post resolver function</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>function post(parent, args, context, info) {
    const userId = getUserId(context);
    return context.prisma.createLink({
      url: args.url,
      description: args.description,
      postedBy: { connect: { id: userId } }
    });
  }</code></pre>
  </div>
  </div>
  </p>
  
  <p>Here is my mutation in the playground</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>mutation{
    post(
      description: "Prisma repalces traditional ORMs"
      url: "www.prisma.io"
    ){
      id
    }
  }</code></pre>
  </div>
  </div>
  </p>