title: How to add a custom header (JWT AUTH TOKEN) in response and redirect user to another page/url in python django
body: <p>I want to have AUTH header for all django requests and responses.</p>
  
  <p>I have a question (python 3.7 - django 2.1):</p>
  
  <p>I want to authenticate the users via JWT tokens.</p>
  
  <p>I don't want to use Models.py or external libraries like as Rest-Framework.</p>
  
  <p>I built a mysql-db for managing CRUD operation for working with JWT-tokens and user-management.</p>
  
  <p><strong>My Problem:</strong></p>
  
  <p>I want to add a "AUTH" header in HTTP request (if username and password were correct) to incoming request from "<a href="http://127.0.0.1:8080/my_dj_app/register" rel="nofollow noreferrer">http://127.0.0.1:8080/my_dj_app/register</a>" page; and then i want to redirect user to Login page ("<a href="http://127.0.0.1:8080/my_dj_app/dashboard" rel="nofollow noreferrer">http://127.0.0.1:8080/my_dj_app/dashboard</a>").</p>
  
  <p>So (when user is redirecting to Dashboard, I'm checking the value of AUTH header in DB in incoming-request), in Dashboard view, again, I'm checking the AUTH header for authorization/authentication the user.</p>
  
  <p><strong>Note:</strong>
  via this topic, i can add AUTH in reponse header. but how i can redirect user to dashboard !?
  <a href="https://stackoverflow.com/questions/14956085/django-add-response-header-when-using-render-or-render-to-response">Django: Add response header when using render or render_to_response</a></p>
  
  <p>above scenario is possible !?. how i can do it !?.  please help meeeee.</p>
  
  <pre><code>response = render(request, "my_dj_app/dashboard.html", {})
  response['AUTH'] = JWT_TOkEN
  return response
  </code></pre>
  
  <p>but above code, can't to solve my problem :(</p>