I have access to
config.action_dispatch.encrypted_cookie_salt
config.action_dispatch.encrypted_signed_cookie_salt
secrets.secret_key_base
- the full cookie string (including
--
)
I see ways to do this in Rails 4 (Rails 4: How to decrypt rails 4 session cookie (Given the session key and secret)), but these don't seem to work in Rails 5.
Here's a Rails 5.2 variant of @matb's answer, which handles the revised configuration, encryption and serialization:
Also up at https://gist.github.com/inopinatus/e523f36b468f94cf6d34410b73fef15e.
I have had the same problem the other day and figured out that the generated secret was 64 bytes long (on my mac), but Rails ensures that the key is 32 bytes long (source).
This has worked for me:
Or without
ActiveSupport
:Feel free to comment on the gist: https://gist.github.com/mbyczkowski/34fb691b4d7a100c32148705f244d028