Forums | Mahara Community

Mahara/Moodle integration /
Can't get Moodle Mahara LTI integration & assign submissions working


07 September 2022, 7:32

Hi Kristina

In Moodle 4.0.3+ you can find it under Site Admin General/Security/HTTP security then you will see the cURL blocked hosts list.

In my case it was the 10.0.0.0/8 entry which blocked the webservice connection to Mahara.

 

Just in case your wondering, I managed to track down the error by commenting out the following lines in the maharaws/classes

mahara_oauth.php file

        if ($this->http->info['http_code'] != 200) {
            throw new moodle_exception('webservice call was not successful');
        }

and adding

echo $url;

echo $method;

echo $params;

Then with full debugging enabled in Moodle it displayed the message mahara.xxx.xxx/webservice/rest URL blocked

Hope that helps

Tim

 

 

 

Kristina Hoeppner's profile picture
Posts: 4820

07 September 2022, 15:26

Hi Tim,

Thank you for that information. I'll add it to my ToDo list for our Refactor Friday to include in the latest version of the Mahara manual.

Cheers

Kristina

08 September 2022, 7:18

Hi Kristina

 

I've also just found that, depending on your server setup, you also get the same "Error when connecting to Mahara web services Check that URL and OAuth credentials are correct and that there is a valid SSL certificate if HTTPS is used. Also check that the correct functions are assigned to the OAuth access." 

if you don't update/add your sites to the server hosts file (which I forgot to do after the ip address changed).

Tim

 

09 September 2022, 14:10

Interesting that 10.0.0.0/8 caused problems for you. We didn't change anything on the default in Moodle and that entry is still there. Maybe our cluster is configured differently though in general.

Simon Lewis's profile picture
Posts: 18

18 April 2023, 3:52

Hello again,

I've been trying again to set up this thing for next academic year. Still with no luck.

So the external LTI tool works fine. But the maharaws, still get that same cert error. I’ve done all suggested, removed and re-added the cURL blocked hosts with no luck (but if the LTI tool is working then it can’t be blocked?)

The certificates are fine, been tested on SSL testing sites etc.

I’ve tested with moodle 3.9 - mahara 22.04 and moodle 4.1 – mahara 22.10 (as complete new/blank installs too).

I’ve tried with them on different servers, and even on both the same server (all windows servers).

But still every time I try to save an assignment I get that same error. I’ve debugged many files, but got nowhere.

 

And when I debug mahara_oauth.php as suggested, I get this (is this what it should be?):

url:  string(72) "https://mymaharasite.ac.uk/webservice/rest/server.php"
method:  string(4) "POST"

params: array(2) { ["wsfunction"]=> string(32) "mahara_user_get_extended_context" ["alt"]=> string(4) "json" }

 

Then the line on the same file, the data I get from $content ($content = call_user_func_array(array($this->http, strtolower($method)), array($url, $params, $this->http_options)); (where it seems to fails)):

string(314) "{
"error": true,
"error_number": 500,
"error_name": "accessexception",
"error_class": "WebserviceAccessException",
"error_message": "Access control exception : Invalid token selected or none supplied",
"error_rendered": "Access control exception : Invalid token selected or none supplied"}"

 

When I var_dump the object(assignsubmission_maharaws\mahara_oauth) prior to call_user_func_array, it seems to look ok (not that I’m sure what to look for there).

Are there any more settings in mahara that can be edited? Nothing shows in the logs (is there a deeper debugging setting for mahara?). I can post some (redacted) mahara screengrabs to see if I’ve missed anything? Or any other ideas at all?

I’m completely stuck tbh. And we’d like to transition to it if possible, as I’m not sure how well the new systems will all work with mnet and PHP8.

I’m also wondering if others are still having issues, whether it’s just windows users or another pattern (or maybe it’s just us still!).

 

Thanks in advance,

Simon

Kristina Hoeppner's profile picture
Posts: 4820

20 April 2023, 8:35

Hi Simon,

There aren't any settings in Mahara once you've turned on the respective web service calls, the LTI plugin, and configured it. What does your setup look like? Do you use Docker for your environments, for example? Since we can't replicate the issue it seems to be a configuration / setup issue on the server.

Thank you

Kristina

25 July 2023, 1:53

I'm stuck at the same problem as Simon.

Running Moodle 4.2.1 and Mahara 23.04.2

With LTI -external tool I have no problem logging in from Moodle to Mahara. I even used auto-account creation, this all works perfectly.

But then I wanted to use the Moodle Assignment Mahara Submission. I get the same error as Simon.

The weird thing is this:

If I go in Moodle to Administration -> Plugin -> Mahara submissions (url /admin/settings.php?section=assignsubmission_maharaws) I can fill in the URL for the Mahara site, the Mahara web services OAuth key and the  Mahara web services OAuth secret just fine.

I can save the information without errors.

Then I go to a course in Moodle, try to add an assignment with Mahara submission... and then the error occurs. Which is really weird because I could save the exact same information in the plugin. So the key and secret are OK and are accepted in the plugin settings, but not in the assignment settings.

Same admin user, logged in in both Mahara and Moodle, with admin rights in both.

Error is:

error/Error when connecting to Mahara web services. Access control exception : Invalid token selected or none supplied Check that URL and OAuth credentials are correct and that there is a valid SSL certificate if HTTPS is used. Also check that the correct functions are assigned to the OAuth access.

 

25 July 2023, 2:08

More info:
AAazjow.png

 

Line 1306 of locallib:

BCU0iO1.png

My 2 cents: the mahara-assign-submission doesn't send complete formdata? Will investigate further.

25 July 2023, 2:18

So I added this:

Po0MIVh.png

This way I could intercept the data that seems to fail. Unfortunately, I could not see anything wrong in the formdata. It looks OK to me, all variables are being passed as expected.

Kristina Hoeppner's profile picture
Posts: 4820

27 July 2023, 5:59

Hi Richard,

I haven't run into this issue, but also not knowing your infrastructure, it's a bit tricky to troubleshoot. Importantly now, which version of PHP are you running? We have not yet tested the Moodle plugin with PHP 8.1. That is in the queue for our Moodle team. It would help to know what PHP you use for Mahara and what for Moodle.

Thank you

Kristina