Reputation: 171321
I set a signed cookie like this:
cookies.permanent.signed[:remember_me] = [user.id, user.salt]
When reading the cookie:
cookies.signed[:remember_me]
I get:
14cc5d64cd84f96f8847726a6ed0e280235025379
What does this value mean? How could I get user's id
back?
I use Rails 3.2.6.
Upvotes: 1
Views: 1103
Reputation: 1570
there is no need to assign the salt to the cookies...the hash is generated automatically by the signed function... you can simply use
cookies[:remember_me] = user.id
Upvotes: 0
Reputation: 1071
i think first of all u should do
cookies.permanent.signed[:remember_me] = user.id
then only you can retreive it by
cookies.signed[:remember_me]
although by signing it no one can decrypt the cookie at client side
Upvotes: 2