Invision Community 4: SEO, prepare for v5 and dormant account notifications Matt November 11, 2024Nov 11
Posted October 12, 20177 yr From a remote server I wish to see if a user is logged in to the application. I have set up the REST API but I don't know what method to call to simply check if a user is logged in or not.
October 13, 20177 yr Author I should clarify, I want to check if a user is logged in using the same web browser. So lets say the master application is located: app.mysite.com and the slave application is mysite.com. I want to be able to check from mysite.com if a user is signed into app.mysite.com
October 13, 20177 yr About the only reliable option there would be to check the sessions table for that member ID, but it's not exposed via the REST API. The REST API isn't designed, or intended, to authenticate or check for authentication. That's what IPS Connect or SSO's are for.
October 13, 20177 yr Author 30 minutes ago, Aiwa said: About the only reliable option there would be to check the sessions table for that member ID, but it's not exposed via the REST API. The REST API isn't designed, or intended, to authenticate or check for authentication. That's what IPS Connect or SSO's are for. I've tried using: /* Require the init.php file from the Community Suite root directory */ require '/path/to/suite/init.php'; /* Initiate the session to verify who this user is */ \IPS\Session\Front::i(); /* Print the user's name */ print \IPS\Member::loggedIn()->name; However, it doesn't work across subdomains.
October 13, 20177 yr You can't do this via the REST API at this time. The REST API is a server-to-server API and has no knowledge of the user that may trigger it to run. Your sample code would work, however you would first need to adjust your Suite installation to set cookies across the parent domain if it's on a separate subdomain.
Archived
This topic is now archived and is closed to further replies.