问题描述
在迁移到 rails 5 之前,它运行良好,但是当我迁移到 rails 5.1.1 时,它给了我类似
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
我使用了与之前版本的 rails 相同的密钥.
I have used same key that we were using in the previous version of rails.
例如
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)
推荐答案
User.last.encryptedpass (User.last.encrypted_password) 您使用的是设计还是我们的加密方法?
User.last.encryptedpass (User.last.encrypted_password) Are you using devise or our on encryption method?
如果消息未使用相同的密钥签名或未进行 Base64 编码,则引发 InvalidSignature.
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
这篇关于ActiveSupport::MessageVerifier::InvalidSignature:Rails 5 中的 ActiveSupport::MessageVerifier::InvalidSignature 错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!