Skip to content

Instantly share code, notes, and snippets.

@thibautsacreste
Last active March 12, 2021 13:43
Show Gist options
  • Star 18 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save thibautsacreste/3899863 to your computer and use it in GitHub Desktop.
Save thibautsacreste/3899863 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