Nikita Singh
Nikita Singh

Reputation: 370

How can I check what csrf token is my rails controller expecting?

My production server is not able to verify the csrf token. I have added the tag for csrf in the application layout and sending it through headers. In my request call I can see the token is included. However my rails app is not able verify it.

Is there any way I can check what csrf token is my controller is expecting?

Upvotes: 2

Views: 3736

Answers (1)

usha
usha

Reputation: 29369

This is part of the code used in ActionController to check for authenticity

form_authenticity_token == params[request_forgery_protection_token]

form_authenticity_token will give you the token your controller is expecting.

Refer to the source code here

Upvotes: 3

Related Questions