I'm using Flask-Login, and Flask-WTF for CSRF protection. I want to add some routes for an API. Since request_loader will be used for the API (header token, no cookies), I want to disable CSRF on those routes.
However, there's no difference between users once they are authenticated. There's no way to tell if they were logged in with a cookie with user_loader or with a header with request_loader.
How can I disable CSRF only when the form is used in API routes? Or how can I prevent cookie users from accessing API routes?