5
votes

I'm getting an "Can't verify CSRF token authenticity" when I try to use my android app to call the create action on one of the controllers in my rails service. Also says "Completed 422 Unprocessable Entity" after that. Any ideas what would cause that? Thanks.

1
Plesse show your api controller.Gerry

1 Answers

3
votes

You can disable the built-in CSRF protection Rails uses by default by adding in your controller (ApplicationController or the one being used) the protect_from_forgery method:

protect_from_forgery with: :null_session

Or also by using the skip_before_action to "skip" the verify_authenticity_token implementation.