Passing Session Vars to iFrame (External sites)

Hey all,
I want to integrate a web application for booking meeting rooms (MRBS, http://mrbs.sourceforge.net ) as an external site in my Nextcloud 11. The MRBS is installed in the same web directory as Nextcloud on hosted webspace.
To solve the authentication issue, I need to pass a session variable to the iFrame. In the External-Sites-App, I have added the following code above the iframe tag in frame.php:
$session = \OC::$server->getSession();
$session->set(ā€˜UserNameā€™, ā€˜testuserā€™);

In the destination frame, I try to get the session variables with:
header(ā€˜P3P: CP=ā€œCAO PSA OURā€ā€™);
session_start();
echo print_r($_SESSION, TRUE);

Unfortunately, the result ist an empty array. Could anyone help me to get the session vars?

I solved the problem creating my own app. In the PageController I added my unencrypted data to the NC session like this:

$session = \OC::$server->getSession();
$mrbssession = session_name();
$session->close();
session_start();
$username = \OC_User::getUser();
$_SESSION['UserName'] = $username;
session_write_close();
return new RedirectResponse("/path_to_the_mrbs/index.php?mrbssession=".$mrbssession);

In the MRBS I can get the session vars starting a session that is named like the NC session using the query string.

Is your app free software and somewhere available? I would like to embed MRBS as well into Nextcloud but havenā€™t written apps up to now.

Have a look at https://teachercloud.de
At the bottom of the page there is a link to a nextcloud demo which contains the mrbs.
You can contact me using the contact form at https://teachercloud.de/de/kontakt