I plan to use the same controller for Normal (basic default http request via browser) and API requests with the help of
- FOSRest: (which will returns the correct data format based on the request type)
- JMSSerializer: to serialize the response data if necessary
Normally, an API request must/should come together with a token to authorize the request. However, when we use the API directly on the website for logged in users, we authorize the users via Session already and thus do not need the API Token to be passed along.
However, the risk of cross site script is still there if we only authorize by Session and not using a CSRF token to recheck (Or may I'm wrong on this?). So if there is that risk, then should/must I also include CSRF in these REST requests?