Currently I have the following in my index.html page:

 <script>
    angular.module("myApp").factory("CSRF_TOKEN", function() {
      return { token: '<?php echo csrf_token(); ?>' };
    });
  </script>

And this in my main app module:

// Add CSRF_TOKEN to each $http request
  .run(function ($http, CSRF_TOKEN) {
    $http.defaults.headers.common['csrf_token'] = CSRF_TOKEN.token;
  });

If the session expires the user logs in through a modal with no page 
refresh. The server creates a new token and includes it with the login 
response. I need to be able to update the value being set in the default 
headers. I've updated to value of the CSRF_TOKEN factory but the .run 
function appears to only check the value once on initial page load. How do 
I update that value? 

Thanks,

Steve

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to