title: Django, React and Rest Framework JWT authentication header missing
body: <p>I'm currently making a Login System in a Django/React with SimpleJWT.</p>
  <p>The Login Backend is in React, which posts the login credentials and gets the JWT-Token from the api. Then it saves the tokens to localstorage and sets it as request-header for axios, for future api calls:</p>
  <pre><code>    const handleSubmit = (e) =&gt; {
      e.preventDefault();
  
      axiosInstance
          .post(`token/`, {
              email: formData.email,
              password: formData.password,
          })
          .then((res) =&gt; {
              localStorage.setItem('access_token', res.data.access);
              localStorage.setItem('refresh_token', res.data.refresh);
              axiosInstance.defaults.headers['Authorization'] =   'JWT ' + localStorage.getItem('access_token');
              history.push(&quot;&quot;);
              location.reload();
          }).catch(err =&gt; console.log(err));
  };
  </code></pre>
  <p>api urls.py:</p>
  <pre><code>path('token/', TokenObtainPairView.as_view(), name='token_obtain_pair'),
  path('token/refresh/', TokenRefreshView.as_view(), name='token_refresh'),
  </code></pre>
  <p>Every API call i make with axios works and only returns after logging in... as it should be...
  BUT the problem is in the second Frontend, which is in Django. It is a partly static frontend that consists mainly out of simple html-templates for the Homepage, but with a Navbar which requires User information.</p>
  <pre><code>@api_view(['GET'])
  def home(request):
      print(request.header)
      context = {
          'posts': posts
      }
      return render(request, 'MainApp/home.html', context)
  </code></pre>
  <p>I noticed that the Authentication Header are simply missing:</p>
  <ul>
  <li><p>When i try to print the user-data after logging in : <code>request.user</code>, output is <code>AnonymousUser</code></p>
  </li>
  <li><p>After making the template view protected by setting the default permission to <code>isAuthenticated</code> in the settings.py
  like this: <code>'DEFAULT_PERMISSION_CLASSES' : ['rest_framework.permissions.IsAuthenticated']</code>
  Then i get <code>401 Unauthorized</code> / <code>&quot;Authentication credentials were not provided.&quot;</code></p>
  </li>
  </ul>
  <p>Also I checked <code>request.META</code> and the authorization-header (HTTP_AUTHORIZATION) is missing.</p>
  <p>Is there a way to get the Token from the localstorage and add it to the request header? I know that this is done on the client side, but why isn't it in this case?</p>