Open bsh185 opened 8 years ago
Can you post a sample? (cookie
, secret
and the desired output)
Something like this
Hi @bsh185
I got a same issue.
If your rails app cookie serializer is using marshal
, maybe you should parse data using marshal instead of JSON.parse.
http://guides.rubyonrails.org/action_controller_overview.html#cookies
https://www.npmjs.com/package/marshal
var secret = '52541783ebfc236dc27e1d83cba2a4144b484897995bdf4d9a9977623987ee10b6e690d3c4218ebc50eccfb68f5babc3db0fcb131d3fbbce142803a03ac500db';
var cookie = 'N0paYjIyWTNIOWgxV2VON0RCM1AvenZzQVNFeWY0elBoQkZ5SnN4OVAybXZQMEErV0VGa1luM2VmYTg4cEk0Y2paVUtMUW8xbEQyUE5VbFJ1OTZUeWJiODdYNkxZSWxvYUtiaE1ucy9LM1BMUy8yd0N0ZExZQzYzUVFsaGZ4M044MjdOdWNJYWhMbW5HOTJpY2UzQUdBPT0tLWtuWk9IWVJpakpWak5oSmZ2d2VLbWc9PQ==--d4292397f777c8f79655884b3fcc241e4bc2fcf5';
var decoder = sessionDecoder(secret);
decoder.decodeCookie(cookie, function(err, result) {
// if cookie serializer is json?
console.log(JSON.parse(result));
// if (cookie serializer is marshal?
var Marshal = require('marshal');
var m = new Marshal(result, 'utf8');
console.log(m.parsed);
});
Thanks.
I am running into a similar issue:
Even after decoding, I get:
{ I"session_id:ETI"%feac424e3fe892c51ebe4ec84bc79ba7;TI"warden.user.user.key;T[[iz�I""$2a$10$dpTCG/6wU74cUJuTxT89d.;TI"warden.user.user.session;T{I"access_uri;FI"login.email;TI"_csrf_token;FI"11CjiyLWWAVJ3CFJMz6ovfWAeZijcDJXsxlSwsZsS+po=;F
So, Marshal throws:
{ [MarshalError: unsupported typecode 189 (index: 97, hex: bd, utf8: �)] name: 'MarshalError', message: 'unsupported typecode 189 (index: 97, hex: bd, utf8: �)' } {
What is the issue here? Please advise.
Im facing an issue where the output has binary text in it I"session_id:ETI"%