How do I solve InvalidAuthenticityToken error from Postman?

347 views Asked by At

I'm running postman to send requests to my rails server. I am facing authenticity token issues when sending POST requests to create new objects. I need to be able to send all requests across the server and add the necessary authentications to a Postman environment.

1

There are 1 answers

0
adesurirey On

If you're creating an API and want to accept requests from other domains you'll need to disable this security filter.

To do it add this to your controller :

skip_before_action :verify_authenticity_token, only: :your_post_action

You can disable it only for json requests, see this answer: https://stackoverflow.com/a/22715175/8352929