Reputation: 173
Before migrating to rails 5 it was working nicely, but when I migrated to rails 5.1.1 it is giving me error like
ActiveSupport::MessageVerifier::InvalidSignature: ActiveSupport::MessageVerifier::InvalidSignature
I have used same key that we were using in the previous version of rails.
Ex.
crypt = ActiveSupport::MessageEncryptor.new(Rails.configuration.secret_key_base)
After executing following line I am getting the mentioned error.
@password = crypt.decrypt_and_verify(User.last.encryptedpass)
Upvotes: 12
Views: 37607
Reputation: 735
Rails 7 here. I found the best explanation of the error in the browser console. It said the form contains a file field but is missing method="post"
and enctype="multipart/form-data"
. Now it works with the following form tag:
form_for(@myitem,
html: { method: :post, class: 'myform', enctype: "multipart/form-data" },
data: { turbo: false }) do...
Upvotes: 0
Reputation: 111
In my case, it was happening because I did not include enctype="multipart/form-data"
Upvotes: 1
Reputation: 345
In my case, I used a name for the attachment
has_one_attached :report
that was already used in the entity (as a table column name)
Upvotes: 8
Reputation: 9185
In my case I was sending undefined
(string) to a video
field (ActiveStorage)
Upvotes: 9
Reputation: 460
In my case I was using form_tag
to send the image to the backend. Using form_with
solved my problem.
Upvotes: 2
Reputation: 44
User.last.encryptedpass (User.last.encrypted_password) Are you using devise or our on encryption method?
Raises InvalidSignature if the message was not signed with the same secret or was not Base64-encoded.
http://api.rubyonrails.org/v5.1/classes/ActiveSupport/MessageVerifier.html
Upvotes: 2