I need to design a RESTful API for Rails, which will enable login from web browser, smart phone, tablet, etc. When I do login it always require X-CSRF-Token, so everytime I need to use session or cookie info. However the REST api should be stateless, which means shouldn’t use cookies. Is there a way to get rid of that? Any suggestion for that?
Share
Here’s how I dealt with this in an app that responds with both HTML and JSON. I want the CSRF check except if it’s an API call from a trusted source, so
application_controller.rb