Is it possible that you are encrypting your cookies somewhere in your code when you set them? In that case you would be setting an encrypted value that in turn, gets encrypted, and retrieving an enctypted-encrypted value. Therefore, you get an encrypted value after it's decrypted the by the framework the first time. This seems inception-like, right!
Nov 20, 2017
9
Level 6
Cookie::get returns encrypted value
Hi guys,
Did anybody run into an issue when the Cookie::get('key') call returns the encrypted value?
I'm receiving something like this:
eyJpdiI6Ikw1bFlMZUQ0UGs3RUZ0SUp3dzlJUVE9PSIsInZhbHVlIjoicXNmb3hLdEpBWGhLZG1BWEtkK2tTQVwvem9VSW96NGpaK25UMGFqaElPWDZ5aFwvamVlWlU5ZnVjNk1KTUNkRWZjIiwibWFjIjoiYjI0YTFlMzJmM2NiZTMxODcxNjc0MWM4Mzc5MTRiNTNlODBhMDI4YjExZTkyNzdjZTIxNzQxZTVjNWZkMmI0YyJ9
So, my temporary solution - which is absolutely not ideal or nice - is:
$value = Cookie::get('key');
try {
$value = decrypt($value);
} catch (DecryptException $e) {
}
What might be wrong in such cases?
Level 28
1 like
Please or to participate in this conversation.