Note that there are some explanatory texts on larger screens.

plurals
  1. POMy jquery AJAX POST requests works without sending an Authenticity Token (Rails)
    primarykey
    data
    text
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. COI remembered answering a similar question.. found it here: http://stackoverflow.com/questions/2725118/rails-request-forgery-protection-settings/2725991#2725991 I guess it should be because its a local request. It should not work say from an app running on a different port or a different domain. Ex: If you have your app running on localhost:3000 you should not be able to do a ajax POST from localhost:3001.
      singulars
    2. COHi Shripad, I saw your post, but how is this happening? Is there some kind of Rails magic involved? Looking online, I still see people writing about instructions to send form_authenticity_token, so if its fixed, why is there still a need to do that?
      singulars
    3. COThis has nothing to do with Rails magic whatsoever. Ajax works without a authenticity token if it is invoked within the domain itself. You need a authenticity token not for enabling ajax to work on your domain but to prevent attacks from other domains. That is the primary reason for having `protect_from_forgery` in your application controller. The best example of an attack from another domain is the "Myspace sammy worm". Look it up. You'll then understand as to why you need a auth token.
      singulars
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload