How to fix mismatched csrf authenticity tokens in rails devise forms?

312 Views Asked by At

enter image description here

If I am understanding this correctly the input authenticity token should be matching the value above in the head element.

When submitting the devise sign up form I get a 422 Unprocessible Entity error.

I did delete my master.key and re-ran rails credentitals:edit to regenerate the RAILS_MASTER_KEY and SECRET_KEY_BASE.

I believe the issue here is since these values are not matching, the form is not being processed resulting in the devise User not being created.

1

There are 1 best solutions below

0
On

Delete config/master.key and config/credentials.yml.enc. Then run rails credentials:edit and it will make a new key and encrypted credentials file. Don't forget to restart the rails server.