I'm currently building an api and encountered the "TokenMismatchException" in the VerifyCsrfToken.php. I'm using postman for testing my api and i added the X-CSRF-TOKEN header in my request, but still i get the TokenMismatchException when submitting a form (through postman to a store method on an api controller). Anyone an idea how to add the csrf token to the form?
As Laravel 5.0.6, X-XSRF-TOKEN is for encrypted token and X-CSRF-TOKEN is for non-encrypted. I think you should use X-CSRF-TOKEN in this case as Session::token() might be returning plain text value.
What I had to do is,add a X-XSRF-TOKEN in the header and copy paste the XSRF token value in the value field.I copied the XSRF token value from the response header of my request and added it against the X-XSRF-TOKEN . This should work pretty well as I have tested it. Laravel expects a X-XSRF-TOKEN token and we need to add it manually in case of postman