title: Creating API for web app with CodeIgniter CSRF protection
body: <p>I have a web application built using CodeIgniter 2 , I have enabled CSRF protection in it. <code>$config['csrf_protection'] = TRUE;</code> My friend is creating mobile app for the same, so he needs API to communicate with Web App. I have created RESTful API in CI using <a href="http://net.tutsplus.com/tutorials/php/working-with-restful-services-in-codeigniter-2/" rel="nofollow">this tutorial</a> . All the request made by mobile app are <code>POST</code> request. The problem I am facing is , since CSRF protection is enabled , and POST request made from mobile does not carry any "CSRF Token" so it is throwing <code>500 internal server error</code>. However if I <strong>disable</strong> CSRF protection everything is <strong>working fine</strong>. What is the correct way to implement it ? Shall I generate token on mobile itself ? Or shall I add exception to CSRF protection ? If so , then how can I do it ? because I don't want to disable CSRF protection. </p>