Last active
April 24, 2024 13:17
-
-
Save mrded/1770067b7d0d45df2652 to your computer and use it in GitHub Desktop.
AngularJS: add csrf token to angular http requests
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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