Forums | Mahara Community

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


Simon Lewis's profile picture
Posts: 17

26 May 2022, 0:01

Hi,

- Mahara Version 22_04 / PHP 7.4
- Moodle Version 3.9.6  / PHP 7.4

Not sure where I'm going wrong, but could with a little help! I want to add the new moodle-assignsubmission_maharaws to use to submit student portfolios, and replace the mnet one.

So, as far as I understand I need to get the LTI configuration working first, before the assign submisson works?

 

What I've done:

- followed the manual: /22.04/external/lti_mahara.html#enable-lti
- auto configured LTI
- registered external app
- service owner - created a specific webservice admin user on moodle and mahara
- Application URI - moodle url?
- Service LTI 1.1
- Parent Authority LDAP. Does this need to be set ?

On moodle
- Enabled webservice in Advanced features
- Enabled webservices and OAuth2 authentication in Site Admin?Plugins>Authentication
- Added LTI tool with tool url mysite.ac.uk/webservice/rest/server.php?wsfunction=module_lti_launch
- LTI version 1.0/1.1
- copied in the key and secret
- open in new window
- privacy - force SSL

When I've added the LTI tool to the course page, at first it didn't work, but then on the 2nd click through, it took me to the mahara assign options, and appears now to work. (although errors when a student tries to submit a folio - '[WAR] c3 (lib\errors.php:530) [Error]: Cannot access protected property ModuleLtiSubmission::$timegraded at E:\sites\public_html\module\lti\submission.php:73' ).

 

Anyway I only want to get the mahara assign submission plugin working, so I installed that.

Configured Mahara with following:
- auto configured LTI
- registered a new external app
- Select 'Moodle Assignment Submission; from the drop-down menu.
- service owner - used the specific webservice admin user on moodle and mahara
- Application URI - moodle url?
- Parent Authority LDAP. Does this need to be set ?

In Moodle:
-In the mahara submission plugin
- Add an assignment in Moodle.
- Select Mahara as the assignment submission type.
- Filled in the following
- URL of your Mahara site
- Mahara web services OAuth key (from the external apps list in Mahara).
- Mahara web services Oauth secret.

When I try and save it I get this error:

'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.'

I've entered/re-entered the consumer keys and secret many times.
SSL certs are fine
They are on separate servers, but it linked fine with Mnet.

In the plugin github instructions it says 'This plugin requires your Moodle site to be connected to a Mahara site via Mahara web services.' I think this may be where I'm not getting it.
On moodle, do I need to create an OAuth2 service in Site administration>Server>OAuth 2 services?
Or some other kind of connection before I do these integrations?

Any ideas or help, would be fantastic.

 

thanks,

Simon

Kristina Hoeppner's profile picture
Posts: 4729

26 May 2022, 10:43

Hi Simon,

We have a patch for this issue currently in testing if you want to give it a go.

Thank you

Kristina

Simon Lewis's profile picture
Posts: 17

27 May 2022, 20:12

Thanks, but that hasn't solved it. I don't think it gets to the Mahara side of things tbh. I think it's something erroring when moodle tries to connect to mahara, and possibly not passing the key and token, but no idea why!

Kristina Hoeppner's profile picture
Posts: 4729

30 May 2022, 9:35

Hi Simon,

Interesting. If the patch didn't help, then I don't know at the moment without going through all your settings in Moodle and Mahara.

Cheers

Kristina

Kristina Hoeppner's profile picture
Posts: 4729

30 May 2022, 14:41

Hi Simon,

I hadn't yet answered an earlier question of yours:

"In the plugin github instructions it says 'This plugin requires your Moodle site to be connected to a Mahara site via Mahara web services.' I think this may be where I'm not getting it.
On moodle, do I need to create an OAuth2 service in Site administration>Server>OAuth 2 services?"

No, you don't need to have anything set up in there. Our Moodle instance didn't need any special configuration.

Did you make sure you went through all the steps mentioned in the Mahara manual? Importantly, you need to configure LTI in the plugin administration. That's best done automatically so that the necessary general web services config is done. While you could flip the switches in the web services config yourself, I'd advise to go via the plugin administration to be sure.

Thank you

Kristina

James Pearce's profile picture
Posts: 2

30 May 2022, 21:44

Hi Simon and Kristina,

We are having a very similar issue with our Mahara assignment submissions plugin. We have after a long process managed to get the LTI connection to work, with help from Catalyst from both sides of the world. 

Our issue is with the oAuth connection and we get the following error on the Moodle side-

error/Error when connecting to Mahara web services. error/webservice call was not successful 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.

As with Simon, I don't think think Moodle is alway able to make a connection with Mahara, although the LTI connection works fine. 

One of the developers from Catalyst UK has managed to pull some more details for the error -

{
"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"
}

We are currently using

  • Moodle 3.9.14 (Build: 20220509)
  • Mahara version 21.10.0

We have installed the latest version of the submission plugin from GitHub.

Any suggestions as to what the issue might be would be very appreciated.

Thanks

James 

Kristina Hoeppner's profile picture
Posts: 4729

31 May 2022, 15:46

Hi James and Simon,

Very sorry, Simon. i mixed up the external tool and the assignment submission plugin. The patch was for the external tool option. The assignment submission plugin web services edition is working on Moodle 3.9 and Mahara 22.04 (and 21.10) as well as Moodle 4 and Mahara 22.04. James, we also have it working with Moodle 3.9 where most of the dev work had happened.

That brings up a valid question though, Simon: Are you using Docker? James, I remember you having had problems with that. Our NZ instances don't run on Docker and never had issues connecting. When we connected to our instance for you, there wasn't a problem either. Something how Docker interacts was causing the problem.

Thank you

Kristina

Simon Lewis's profile picture
Posts: 17

07 June 2022, 2:19

Hi,

Thanks for your reply. I'm not using docker and I have been configuring LTI in the plugin administration automatically.

I've tried again, with these versions: mahara 22.4.1, moodle on 3.9.6
Currently we have an mnet connection setup and working fine (sso, click through to mahara submissions, uploading etc) 

Followed these instructions https://manual.mahara.org/en/22.04/external/lti_mahara.html 
In Mahara>Admin>Extensions>Plugin admin I auto configured LTI
In Mahara>Admin>Webservices>External Apps I added a webservice for moodle site
For service owner I put my own account (I'm site admin on both sites). Is it better to create a dummy site admin account for this?
Application URI? Left as default of example.com does this matter?

More settings via the External Apps cog - Have not changed any of these

On moodle
- Enabled webservice in Advanced features
- In Site Admin>Plugins>Authentication, so no need to enable webservices or OAuth2 authentication? Currently not enabled.
- Followed these instructions (https://manual.mahara.org/en/22.04/external/lti_moodle.html) and added an LTI tool to the course. Clicked through and worked fine, saved settings
- logged in as a student to moodle and clicked on the LTI tool. Had to re-log in to mahara, but once I'd done that it worked fine and I could submit, and teacher can see submission etc

So the LTI tool appears to all work fine, now for the mahara assign submission plugin

- on mahara Generated a consumer key and consumer secret, selected 'Moodle Assignment Submission' (left the rest as default)
- on moodle added plugin, enabled, adding global settings etc
- on moodle added assign with that submission type, but it errors as I try to save it:

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.

[06-Jun-2022 14:56:24 Europe/London] Default exception handler: 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. Debug: 
Error code: 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.
$a contents: 
* line 498 of \lib\setuplib.php: moodle_exception thrown
* line 1272 of \mod\assign\locallib.php: call to print_error()
* line 760 of \mod\assign\locallib.php: call to assign->update_plugin_instance()
* line 41 of \mod\assign\lib.php: call to assign->add_instance()
* line 128 of \course\modlib.php: call to assign_add_instance()
* line 168 of \course\modedit.php: call to add_moduleinfo()

 

The errors only occur on the moodle logs, nothing at all mahara logs. The MNet connection is still working fine, I tried disabling, in case there was a conflict but made no difference. And there are valid certificates for everything.

Are there any php extensions that need enabling for this specifically?

The next step I'll try is 2 clean empty versions of both, rather than copies of current sites. But if you sport anything I've missed let me know!

thanks

Kristina Hoeppner's profile picture
Posts: 4729

08 June 2022, 12:11

Hi Simon,

Thank you for that information. Some answers and comments:

  1. "For service owner I put my own account (I'm site admin on both sites). Is it better to create a dummy site admin account for this?" I'd recommend setting up a 'web services' account with institution admin permissions in the institution a you'll otherwise be logged out when someone tries to log in.
  2. "Application URI? Left as default of example.com does this matter?" This is not needed.
  3. BTW, you can simply select 'Moodle assignment submission' also for a regular LTI launch. No need to set up two connections because the Moodle assignment contains the lti_launch web service.
  4. Settings via the 'Manage screen': Do take a look. If you don't allow the creation of accounts, people who don't already have an account won't be able to connect. Also, if you do have another auth method configured and you try to log in via LTI, you won't be able to because LTI sees that you already have an account but that is not allowed to use LTI.
  5. "On Moodle. In Site Admin>Plugins>Authentication, so no need to enable webservices or OAuth2 authentication? Currently not enabled." Correct. I never configured that as we are not logging into Moodle via OAuth. We are going to Mahara.
  6. "logged in as a student to moodle and clicked on the LTI tool. Had to re-log in to mahara" That shouldn't have happened. It means that something is incorrect in the tool setup. Usually, I've seen this when someone didn't add "/webservice/rest/server.php?wsfunction=module_lti_launch" at the end of the URL to their Mahara site when configuring things in Moodle. The LTI tool needs the full path to the web services function whereas the Mahara assignment submission plugin can work with just the regular wwwroot.
  7. "on moodle added assign with that submission type, but it errors as I try to save it" Does the person who tries to jump already have an account on Mahara? If so, is it associated with LTI or still with MNet? If it is the latter, please switch the auth method to LTI and try again or better yet try with a person who doesn't yet have an account but make sure to allow account creation first in Mahara for the LTI connection (see #4).

Thank you

Kristina

Simon Lewis's profile picture
Posts: 17

09 June 2022, 1:14

Hi,
Thanks for you help with this, I appreciate it. But, still no luck unfortunately. 
So I’ve set up a clean install of both moodle 3.11.7 and mahara 22.4.1, just to make sure nothing else was conflicting. No specific institutions created.
1.    I’ve added a webservice user, mahara=institution admin, moodle =site admin
2.    Ok left empty
3.    Just using the 1 LTI connection
4.    I’ve added allow creation of accounts, but I don’t think this is the issue, so I’ll look at this more later on, as we use LDAP as the auth method 
5.    Ok
6.    External tool LTI is now working fine, and set up with that full, extended url
7.    Yes the user has an active mahara webservice auth account (with the right assignsubmission/maharaws:configure privileges on moodle). So when they add a new assign, adds mahara as submission type, tries to save, and gets that error. 
Also tried with a new user, with a person who doesn't yet have an account but making sure to allow account creation first. Still no luck.

So even with an out of the box moodle/mahara I can’t get anywhere! 
If the LTI external tool is working, then that would mean it should work fine? Eg the certificate error is a red herring? And webservices are working between the systems, which would narrow it down to an issue in the plugin?

Thanks, 
Simon

66 results