title: How to set cookie without response in Django or DRF?
body: <p>I tried this <code>response = Response()</code> method but it is not set in the browser cookie
  Because my function return user and token instead of <code>response</code>.Any possibility to set cookie in browser without response or <code>httpResponse</code>?..</p>
  <p><strong>views.py(It does not work):</strong></p>
  <pre><code>     def authenticate(self, request):
              ......
              new_access_token = result.get('access')
              
              response = Response()
              response.set_signed_cookie(
                         key = settings.SIMPLE_JWT['AUTH_COOKIE_ACCESS'], 
                         value = new_access_token,
                         salt = settings.SIMPLE_JWT['AUTH_COOKIE_SALT'],
                         expires = 214748364,
                         secure = settings.SIMPLE_JWT['AUTH_COOKIE_SECURE'],
                         httponly = settings.SIMPLE_JWT['AUTH_COOKIE_HTTP_ONLY'],
                         samesite = settings.SIMPLE_JWT['AUTH_COOKIE_SAMESITE']
                         )
                          
          return self.get_user(validated_token),validated_token
  </code></pre>
  <p><strong>-- Full View.py(above is short) --</strong></p>
  <pre><code>from rest_framework_simplejwt.authentication import JWTAuthentication
  from rest_framework_simplejwt.exceptions import InvalidToken
  from django.conf import settings
  import requests
  import json
  from rest_framework.response import Response
  from .utility import set_browser_cookie
  
  class CustomAuthentication(JWTAuthentication):
      
      def authenticate(self, request):
          header = self.get_header(request)        
          if header is None:
              raw_token = request.get_signed_cookie(settings.SIMPLE_JWT['AUTH_COOKIE_ACCESS'],salt = settings.SIMPLE_JWT['AUTH_COOKIE_SALT'],default = False) or None
          else:
              raw_token = self.get_raw_token(header)
          if raw_token is None:
              return None  
          
                
          try:
              validated_token = self.get_validated_token(raw_token)
          except InvalidToken:
              refresh = request.get_signed_cookie(settings.SIMPLE_JWT['AUTH_COOKIE_REFRESH'],salt = settings.SIMPLE_JWT['AUTH_COOKIE_SALT'],default = False)
              if refresh is None:
                  return None            
                            
              protocol = 'https' if request.is_secure() else 'http'
              domain_name = settings.SITE_DOMAIN_NAME
              url = f'{protocol}://{domain_name}/auth/api/token/refresh/'
              data = {&quot;refresh&quot;: refresh}
  
              resp = requests.post(
                  url, 
                  data=json.dumps(data),
                  headers = {'content-type': 'application/json'}
                  )
              result = resp.json()
              new_access_token = result.get('access')
              
              if new_access_token is None:
                  return None
              
              validated_token = self.get_validated_token(new_access_token)
              
              response = Response()
              response.set_signed_cookie(
                         key = settings.SIMPLE_JWT['AUTH_COOKIE_ACCESS'], 
                         value = new_access_token,
                         salt = settings.SIMPLE_JWT['AUTH_COOKIE_SALT'],
                         expires = 214748364,
                         secure = settings.SIMPLE_JWT['AUTH_COOKIE_SECURE'],
                         httponly = settings.SIMPLE_JWT['AUTH_COOKIE_HTTP_ONLY'],
                         samesite = settings.SIMPLE_JWT['AUTH_COOKIE_SAMESITE']
                         )
                          
          return self.get_user(validated_token),validated_token
  </code></pre>
  <h2>Please help me I am very confuse for this.</h2>