简体   繁体   中英

Associate laravel_session cookie with session file

I have a user authenticated in a laravel app. I have a third party app that needs to see if this user is authenticated in said laravel app. I see there is a cookie called laravel_session and the contents are something like:

eyJpdiI6ImZIdGo0XC9cL1I2RWpzOUppQmRqcTljNFZ0SFJNMTBrc3l5OTVIN12h3ks03RT0iLCJ2YWx1ZSI6InNMWXZCcm44N1pmVnpTWEU3WStEMTBNckJGUFdJVEJFY3lMWGNIdUVkS0p5RlwvNzJGVXVpVFEwZnNqSDdFc0c4d0hPOTIrSFA3UG1heFIxanZWWk1231209IiwibWFjIjoiYzc1MTQxNjEyMTU5MTdjZGE0NDYwOTY2OGExYTYxOTc0MjA5MmJhdsdhZDMwOGZjNmIzYjE0ZmQ4MDI3MjkwMCJ9

I see in the app/stoage/session directory, one file named 164d51a82e239ae352792311f24e29c3670bf027 which contains the correct serialized data for that user.

How do I associate the two without loading up any laravel classes/code? In other words, how do I find out which session file belongs to the user just by their cookie info?

Thanks!

Laravel automatically encrypts it's cookies with PHP's mcrypt extension.

You can try modify Laravel cookies implementation but this is not recommended.

Maybe writing an artisan command that uses the Encrypter class will be the solution, or just find another way to achieve your goal.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM