The place for more technical questions for those who want to create new pagetypes or bespoke functionality.

xAPI without LTI not recording data out of Xerte session

  • gerval
  • Topic Author
  • Offline
  • New Member
  • New Member
More
4 years 1 month ago #8168 by gerval
Hi,

First of all, thanks to all for this great tool that is Xerte.

I am using Xerte (3.10.5) with SAML2 authentication, Trax LRS (starter edition 2.0.1) and Moodle (3.9). Xerte and Moodle (https) behind a reverse proxy Nginx. Trax (http) on the local network.
LTI works fine with Moodle. I had troubles with LTI + xAPI because of wrong URL such as :
POST /xertetoolkits/xapi_proxy.php &tsugisession=1/statements
(& should not be there!)

I have replaced the following line (146, 257) in .../modules/xerte/play.php

$tracking .= " var lrsEndpoint = '" . $xerte_toolkits_site->site_url . (function_exists('addSession') ? addSession("xapi_proxy.php") . "&tsugisession=1" : "xapi_proxy.php") . "';\n";

With this piece of code

$sessionTextToAdd = "";
if (function_exists('addSession')) {
$sessionTextToAdd = addSession("xapi_proxy.php");
}
if (($sessionTextToAdd != "xapi_proxy.php") && ($sessionTextToAdd != "")) {
$sessionTextToAdd .= "&tsugisession=1';\n";
}
else {
$sessionTextToAdd = "xapi_proxy.php';\n";
}
$tracking .= " var lrsEndpoint = '" . $xerte_toolkits_site->site_url . $sessionTextToAdd;

Don’t know if it is the most elegant solution but now LTI + xAPI works fine with Moodle and I get consistent data in xerte dashboard. This was to share with you!

I still have another problem, prior to previous one. If we want to use xAPI without LTI by launching the following URL: .../xapi_launch.php?template_id=159&group=groupname
Xerte LO works fine in the browser, but we have no record in Trax LRS.
If I launch this URL within my Xerte Author Session, it works, and I get records in Trax!
Session, authentication… I'm running out of ideas. Has anyone seen this kind of problem?

Jean-Pierre

Please Log in or Create an account to join the conversation.

More
4 years 1 month ago #8169 by tom
I'll have a look at the code. Thank you!

As to the other issue. You can enable $developer mode by setting $development to true in config.php around line 43.

Then look in error_logs/debug.log. Specifically to the xapi_proxy.php lines. Hopefully that will give you an idea what goes wrong.

Please Log in or Create an account to join the conversation.

  • gerval
  • Topic Author
  • Offline
  • New Member
  • New Member
More
4 years 1 month ago #8173 by gerval
Hi Tom,
Thanks for your answer.
$_SESSION is empty in xapi_proxy.php
Using _debug() I can follow $_SESSION["XAPI_PROXY"] data in xapi launch.php, play.php, etc. but it disappeared in xapi_proxy.php

Please Log in or Create an account to join the conversation.

More
4 years 1 month ago #8174 by tom
Hmm... the session is added in the xapi_proxy.php (by require("config.php");

And your change has also to do with sessions. But as far as I can tell you did not break anything.

Please Log in or Create an account to join the conversation.

  • gerval
  • Topic Author
  • Offline
  • New Member
  • New Member
More
4 years 1 month ago #8175 by gerval
Hi Tom,
Some progress... I think I have found a solution.
At the beginning of the xapi_launch.php script, I commented out two lines and added some ini_set() just in case.
I retested the different use cases: LTI, LTI+xAPI, xAPI alone
It works!

if (!$lti_enabled)
{
require_once(dirname(__FILE__) . "/session_helpers.php");
//ini_set('session.use_cookies', 0);
//ini_set('session.use_only_cookies', 0);
ini_set('session.use_trans_sid', 1);

ini_set('session.use_strict_mode', 1);
ini_set('session.cookie_samesite', "Strict");
ini_set('session.cookie_lifetime', 0);
}

Please Log in or Create an account to join the conversation.

Moderators: JohnSmith
Time to create page: 0.140 seconds
Copyright © 2026 The Xerte Project.
Xerte logo Apereo logo OSI Logo