title: How does refreshing of jwt token work in django REST angular
body: <p>I am using this</p>
  
  <p><a href="http://getblimp.github.io/django-rest-framework-jwt/#refresh-token" rel="nofollow">http://getblimp.github.io/django-rest-framework-jwt/#refresh-token</a></p>
  
  <p>I am confused how to make it work. I have done all settings as said. Now how to make it work.</p>
  
  <p>Currently i have code to get first token when user submits login and i save that token in cookie store. Then my request use that token for all requests. I have seen that token sometimes expries and i don't want that. so thats why i am using this</p>
  
  <pre><code>$http
      .post('/api-token-auth/', logData)
      .then(function (response) {
          // assumes if ok, response is an object with some data, if not, a string with error
          // customize according to your api
          if (!response.data.token) {
              _vm.authMsg = 'Incorrect credentials.';
              deferred.reject('Incorrect credentials.');
          } else {
              $cookieStore.put('djangotoken', response.data.token);
              $http.defaults.headers.common.Authorization = 'JWT ' + response.data.token;
              $http.get('/api/account/restricted/').then(function (response) {
                  authService.loginConfirmed();
                  $cookieStore.put('currentUser', response.data);
                  $rootScope.$broadcast('user:login');
              });
          }
          deferred.resolve(response.data);
          }, function (x) {
              _vm.authMsg = 'Server Request Error';
              deferred.reject('Server Request Error');
          });
  </code></pre>
  
  <p>This is how i am using that token in every request</p>
  
  <pre><code>   $http.defaults.headers.common['Authorization'] = 'JWT ' + $cookieStore.get('djangotoken');
  </code></pre>
  
  <p>Now what do need to do to make refresh token work. I mean does user has to manually refresh the token or system will automatically do it. and at what point do i need to visit this url</p>
  
  <pre><code>url(r'^api-token-refresh/', 'rest_framework_jwt.views.refresh_jwt_token'),
  </code></pre>