Skip to content

Instantly share code, notes, and snippets.

@kirel
Created January 13, 2014 15:10
Show Gist options
  • Select an option

  • Save kirel/8401981 to your computer and use it in GitHub Desktop.

Select an option

Save kirel/8401981 to your computer and use it in GitHub Desktop.
module AngularCsrf
def self.included(klass)
klass.after_filter :set_csrf_cookie_for_ng
end
protected
def set_csrf_cookie_for_ng
cookies['XSRF-TOKEN'] = form_authenticity_token if protect_against_forgery?
end
def verified_request?
super || form_authenticity_token == request.headers['X-XSRF-TOKEN']
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment