ruby 3.0.1 rails 6.1.2 'devise', '~> 4.7', '>= 4.7.3'
I'm in a very unusual situation. I am migrating a rails installation from one server to another. I believe I am about 95% of the way, having just restored the production database.
However, anything involving a form submission, including user registration and logging in, gives me the error page:
The change you wanted was rejected. Maybe you tried to change something you didn't have access to. The server log gives me something more helpful:
Completed 422 Unprocessable Entity in 2ms (Allocations: 433) FATAL -- ActionController::InvalidAuthenticityToken This confuses me. Because I did regenerate the master.key and credentials.yml.enc and made the contents of the master.key available via the RAILS_MASTER_KEY environment variable. This means that the forms have the proper <input type="hidden" name="authenticity_token" value="<removed for stack_overflow>"> included to shield against cross-site scripting attacks.
I don't think it has anything to do with sessions because even user registration is affected by this. I am using Devise for authentication.
But... now I've hit a brick wall. There's nowhere to go from here. Does anyone know what's wrong?
Update 1
Adding skip_before_action :verify_authenticity_token did allow me to skip past the problem. I am not comfortable with that as a solution.
Update 2
I have these meta tags.
<%= csrf_meta_tags %> <%= csp_meta_tag %>
devise?