Skip to content

Instantly share code, notes, and snippets.

@ayamomiji
Created December 4, 2013 16:36
Show Gist options
  • Save ayamomiji/7790760 to your computer and use it in GitHub Desktop.
Save ayamomiji/7790760 to your computer and use it in GitHub Desktop.
add csrf token to angular http requests
module = angular.module(...)
module.config ($httpProvider) ->
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