Skip to content

Instantly share code, notes, and snippets.

@carld
Forked from thibautsacreste/rack_show_session.rb
Last active September 13, 2021 05:17
Show Gist options
  • Save carld/fece38eb2fe81a2db328 to your computer and use it in GitHub Desktop.
Save carld/fece38eb2fe81a2db328 to your computer and use it in GitHub Desktop.
Ruby: decode rack session cookie
require 'base64'
require 'cgi'
def show_session(cookie)
Marshal.load(Base64.decode64(CGI.unescape(cookie.split("\n").join).split('--').first))
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment