-
☆ A M B ☆
- 2,475 Posts
This is sort of a weird situation, but if I grab a user's sessionid from the modx_user_attributes table, is there a way to use that sessionid to see if that user is logged in or not? This is *not* for the current user: we need to check on other users. We're doing an oAuth login flow so when a user comes to our MODX site, they also get logged in on another site and we pass that site a few bits of data about the user (e.g. username, email, etc.). The other site then makes some API requests back to our site to retrieve additional data (specifically data that might change as the user does stuff on the site).
I'm wondering if I pass the sessionid to the other site along with the other userdata upon login if the other site can hash that sessionid and we can use that to authenticate the request somehow. E.g. other site sends us md5($sessionid) and we can do md5($user->get('sessionid')) and if they match we know the other site is making a legitimate request for this session.
Or in more broad terms, can I look at the sessions in the database and know whether a user's session is active or not?