You can see here on your page (gigub) , which only checks for ApplicationController
Admin and Users controllers work fine with protect_from_forgery with: :exception
The default behavior for Rails 4 for protect_from_forgery is :null_session , you can remove the with: option if you want.
On the improvement, I would implement a way to save the token in the user and match for each request, so the user requesting the API will have to send their token to each request. By doing this, you avoid the need to obtain a CSRF token, and then send a request with that token. For example, for mobile users, this is one additional request, where you can solve by simply saving the correct token. If someone receives this token, he can go through as a user and change the data. But you can find more ways to make it safer.
CSRF can happen if you save the token in sessions or cookies, you will have to take care of this yourself if you decide to save this.
If you intend to use the API for mobile phones, save the token (in the first of my strategies) on your mobile device (memory or local db), and it will be more secure.
source share