Skip to content

Instantly share code, notes, and snippets.

@mrded
Last active April 24, 2024 13:17
Show Gist options
  • Save mrded/1770067b7d0d45df2652 to your computer and use it in GitHub Desktop.
Save mrded/1770067b7d0d45df2652 to your computer and use it in GitHub Desktop.
AngularJS: add csrf token to angular http requests
angular.config(function($httpProvider) {
var authToken = $('meta[name="csrf-token"]').attr('content');
$httpProvider.defaults.headers.common["X-CSRF-TOKEN"] = authToken;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment