Checking session from external PHP

I’m new here, so please forgive basic ignorance on my side.
I have other web-apps such as Dokuwiki and Roundcube running on the same server as NextCloud, and I would like to tweak their code (all PHP) to determine if the user is already in a NextCloud session, in which case I will log him in directly to those other apps as well.
Is there a clever way to do it? I tried reading the $_SESSION but to no avail…

Nextcloud encrypts the session storage. You’ll be out of luck.

Generally this isn’t the way to integrate authentication. Use an IdP and configure it for all three software solutions. Then you have your centralized login.