I have Magento 2 installed in a directory at mydomain.com/shop and I want to access the user's session data outside of that folder (specifically user id and isLoggedIn) so I can use it to log them into another app. I set my Magento cookie path to "/" but what code do I need to grab the session from domain.com/file.php?
Hi,
You should:
1. Set correct session_id($sid) the same like in magento.
2. Set correct session_save_path like in magento(disk,redis or something else)
3. Make session_start()
Session data will be available in $_SESSION.
Contact me in PM if you need more help.
Thanks.
I do not need to set the cookie/session data separately I just need to access the built in Magento session methods.
Me too... Anyone have any idea?
I need something like if ($magentoSession->isLoggedIn() == TRUE) from outside of Magento. I set the cookie path to "/" but how do I access it the Magento way?
Is it secure to rely on the REST API like this to get the user ID and if they are logged in or not?