I've been trying to use Postman with my Play Framework API, but I keep running into problems related to the CSRF Filter.
I've browsed a few forums (including SO) looking for a fix to this, and the proverbial advice seems to be adding:
play.filters.disabled+=play.filters.csrf.CSRFFilter
to the application.conf
file.
I've tried performing that fix, but even when I do so, I continue to get this error in the console logs:
[warn] p.filters.CSRF - [CSRF] Check failed because no token found in headers for /auth/logout
Where /auth/logout
is a POST request with the Authorization
cookie set as a JWT.
I've tried a number of alternative fixes, such as setting play.filters.disabled
to []
or null
, allowing all hosts through the CORS filter, various combinations of all 3, etc, but ultimately the same error appears in my logs.
The only thing that's made a change to the application at all is setting the CSRF token as a cookie instead of in the session, which changes the error to:
[warn] p.filters.CSRF - [CSRF] Check failed because none/none for /auth/logout
This gives me the comfort of knowing at least that the application.conf
is being loaded correctly, but it still doesn't fix the problem.
Is there a correct way to disable the CSRF filter that I'm not doing properly? Is there another way to allow Postman to work through the CSRF filter?