JWT Authentication: Use UI token to authenticate Graphene/Django (GraphQL) queries?
<p>I am working on a project with the following architecture:</p>

<ul>
<li><p>UI: React on client and server-side rendering via a Node server, Apollo Client for GraphQL,</p></li>
<li><p>API: Django handles GraphQL queries through Graphene.</p></li>
</ul>

<p>I use Auth0 (JWT based) for my frontend authentication. I would like to use the token I get to authenticate my user in the context of the GraphQL queries API side.</p>

<p><strong>[Edit2]</strong></p>

<p>To pass the token to my API, I use:</p>

<pre><code>const idToken = cookie.load('idToken') || null;
networkInterface.use([{
  applyMiddleware(req, next) {
    if (!req.options.headers) {
      req.options.headers = {};  // Create the header object if needed.
    }
    req.options.headers.authorization = `Bearer ${idToken}`;
    next();
  }
}]);
</code></pre>

<p>Then I need to retrieve it in Django: I use django-jwt-auth and the code proposed by @Craig Ambrose.</p>

<p>My authorization header is received and decoded (I can get the payload) but there is a problem when verifying the signature: I get "Error decoding signature."</p>

<p>This is strange since the signature is verified when I test it on jwt.io.</p>

<p>How can I authenticate on Django side ? </p>