LTI Moodle to Moodle: Difference between revisions

From MoodleDocs
Line 98: Line 98:
This can happen when the course content isn't embedded. Enable Allow frame embedding in Site Administration > Security > HTTP Security and, on the consumer site LTI tool settings, add force_embed=1 in the custom parameters settings.
This can happen when the course content isn't embedded. Enable Allow frame embedding in Site Administration > Security > HTTP Security and, on the consumer site LTI tool settings, add force_embed=1 in the custom parameters settings.


==Invalid request==
===Invalid request===
This exception can happen for various reasons, so it can be difficult to trace the root of the problem. One of the possibilities is that deep linking is enabled in the tool consumer.
This exception can happen for various reasons, so it can be difficult to trace the root of the problem. One of the possibilities is that deep linking is enabled in the tool consumer.
==See also==
==See also==



Revision as of 15:49, 7 March 2024

Moodle to Moodle LTI

This document focusses on connecting Two instances of Moodle 4.3 or later via LTI1.3 (Advantage). For more general details of LTI see Publish as LTI tool

LTI Advantage

This document will focus on LTI Advantage, which is described here https://www.imsglobal.org/activity/learning-tools-interoperability. And covers Assignment and Grade Services, Names and Role provisioning and Deep Linking. Term 'Tool' is used to refer to the external service providing functionality, while 'Platform' is used to refer to the application wanting to use the functionality provided by the tool. So where you see Platform think “Provider” and where you see Tool you can think “Consumer” Enabling the 'Publish as LTI tool' feature

An administrator can enable the 'Publish as LTI tool' for use across the site:

  1. Go to Site administration > Plugins > Authentication > Manage authentication and enable LTI (admin/settings.php?section=manageauths)
  2. Go to Site administration > Plugins > Enrolments > Manage enrol plugins and enable 'Publish as LTI tool' (/admin/settings.php?section=manageenrols)

It is recommended that the site administration setting 'Allow frame embedding' is enabled (in "Site Administration > Security > HTTP security") so that tools can be displayed within a frame rather than in a new window, if desired. (/admin/search.php?query=allowframembedding) Configure Moodle as the Tool Registration between Tool (producer) and Platform (consumer) is essentially a security contract between those two systems. Dynamic registration automates the exchange of the relevant URLs and IDs.

As an admin user, go to "Site administration > Plugins > Enrolments > Publish as LTI tool > Tool registration" (/admin/settings.php?section=enrolsettingslti_registrations) Click the "Register a platform" button to create a new platform registration Enter the name of the platform and click "Continue" When presented with the "Tool details" tab, click to copy the Registration URL under the "Dynamic registration" section

Configure Moodle as the Platform

On the Platform (consumer) as an admin user, go to "Site administration > Plugins > Activity modules > External tool > Manage tools" (/mod/lti/toolconfigure.php) Paste the registration URL into the "Tool URL" field Click "Add LTI Advantage" If prompted, select "Register as a new external tool" (you will only be prompted if another Moodle tool from the same domain is already configured on the platform) When the page reloads and the tool card is visible, click "Activate".

Once complete, platform details and an associated deployment id will have been automatically added to the registration in the Moodle tool. To see this, go to

"Site administration > Plugins > Enrolments > Publish as LTI tool > Tool registration". (/admin/settings.php?section=enrolsettingslti_registrations)

You'll see the updated registration listed as "Active". Clicking the "View platform details" action will display the relevant platform information, while the "Manage deployments" action will allow you to add or remove deployments. No changes to either of these sections are required, however.

Sharing access to a course or activity

From the course navigation, select "Published as LTI tools" Under the "LTI Advantage" tab (this is selected by default) click the "Add" button In "Tool to be published" select the course or activity to be shared Enable grade and user sync for the resource, if required Click the "Add method" button

The published activity or course is now ready for use in platforms via the content selection flow.

Note: The fields "Launch URL" and "Custom properties" are only relevant when sharing the content with instructors who don't have an account in the Moodle tool. If you're using Content selection, you can ignore these values. Grade and user synchronisation (if configured) is handled asynchronously via the 'Publish as LTI tool grade sync' and 'Publish as LTI tool users sync' scheduled tasks, which run by default every 30 minutes. If user synchronisation is set to yes, enrolled users in the remote system are synchronised with enrolments in the course, with an account created for each remote user as necessary, and the user enrolled or unenrolled as required. If set to no, at the moment when a remote user accesses the tool, an account will be created for them and they will be automatically enrolled.

User account provisioning

When users access a shared activity or course for the first time, Moodle will need to either find an existing account or create an account for them. Historically, all first launches resulted in the creation of new user accounts in Moodle, meaning users with existing accounts had no way to reuse those accounts. Account provisioning modes solve this problem by providing control over how accounts are created or linked on first launch. Additionally, in the case of teachers, they permit a richer experience via Content Selection, a process allowing the teacher to launch into Moodle using their existing Moodle account and select from any shared course or activity they have access to. More on this in the next section.

There are two relevant settings in the published resource settings; "Student first launch provisioning mode" and "Teacher first launch provisioning mode". Each setting controls how Moodle will handle the first launch for a user of that particular role (the role assigned to the user in the platform from which they launch the tool). Currently, several modes are supported:

  • New accounts only (automatic) - A new account will automatically be created for the user during first launch. This account will then be reused on subsequent launches.
  • Existing and new accounts (prompt) - The user will be prompted to either link an existing account they have in Moodle, or have a new account created for them. Subsequent launches will use whichever account is the result of this choice.
  • Existing accounts only (prompt) - Only existing accounts may be used. If the user does not have an existing Moodle account to use, they will be unable to access the shared resources.


By default, "Teacher first launch provisioning mode" is set to "Existing and new accounts (prompt)", granting teachers flexibility in how they access the tool resources. Those having accounts can choose to use their existing account, while those not having an account can opt for the latter.

The default for "Student first launch provisioning mode" is "New accounts only (automatic)". Students will have accounts created for them automatically during first launch.

Content selection launches (Deep linking) require an existing account in Moodle, so always use "Existing accounts only (prompt)". Users without an account in Moodle cannot use this feature.

Each setting can be changed for each published resource, however, with a caveat. Once a user account is linked to a platform user, subsequent launches by that platform user will use that linked account. If a user accesses one resource using 'automatic' provisioning mode, and then later launches another resource which permits the use of existing accounts, the user will not be prompted to sign in because an account is already associated with them (the account which was automatically created for them during the first launch). The same is not true for the reverse situation. If the user accesses a resource permitting the use of existing accounts first, their existing account can be linked. Subsequently, accessing a resource using 'automatic' provisioning mode, will only result in the reuse of their existing (now linked) account, and not the creation of a new account.

On the LTI platform site

The preferred means of configuring a course or activity link is by using Deep Linking (Content Selection), however, this requires that instructors have an existing account on the Moodle tool site.

Teachers can select from a list of published activities and courses, optionally adding a coupled line item to the platform's grade book by selecting "Add to gradebook"
  1. Make sure you're signed in to the Moodle tool site in another browser tab (if not, you will be prompted to do so later)
  2. In the platform site, visit a course
  3. Add an External Tool activity, or select a pre-configured tool from the activity chooser.
  4. Click the "Select content" button
  5. When prompted, link your account
  6. Select from a list of activities and courses to which you have access (optionally adding line items to the platform gradebook, where applicable - see note below), clicking "Add content" when done
  7. Save and launch the activity

Custom launch parameters

Note: If you would prefer to not show blocks for teachers, you can pass the custom parameter "force_embed = 1". This may limit the functionality available to teachers and admins. To get blocks back, simply remove the parameter.

Common issues

Mixed protocol limitations

If your Moodle instance is using HTTP (and not HTTPS) you will only be able to use the tool on sites that are also using HTTP (and not HTTPS). It's recommended that you use HTTPS on your Moodle instance. See Transitioning to HTTPS.

A required parameter (oauth_consumer_key) was missing

This exception occurs when the Tool Consumer is missing a Consumer Key parameter. As mentioned above, the consumer key can be anything you want so long as the field isn't left empty. Best keep it simple and without special characters, however.

User has free access to the entire site, isn't contained to the course

This can happen when the course content isn't embedded. Enable Allow frame embedding in Site Administration > Security > HTTP Security and, on the consumer site LTI tool settings, add force_embed=1 in the custom parameters settings.

Invalid request

This exception can happen for various reasons, so it can be difficult to trace the root of the problem. One of the possibilities is that deep linking is enabled in the tool consumer.

See also

Any further questions?

Please post in the LTI and Moodle forum on moodle.org