Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-78578

Site policy redirection results in error on enrol/lti/launch.php

XMLWordPrintable

    • MOODLE_401_STABLE, MOODLE_402_STABLE, MOODLE_403_STABLE
    • MOODLE_401_STABLE, MOODLE_402_STABLE
    • MDL-78578-401
    • MDL-78578-402
    • MDL-78578-master
    • Easy
    • Hide

      Prerequisites

      1. You need two Moodle sites (localhost is fine) - one called 'platform' and one called 'tool'
      2. In the tool site admin settings:
        • Enable enrol_lti and auth_lti plugins
        • Enable "Allow frame embedding"
      3. In BOTH sites:
        • Go to "Administration > Security > HTTP security" and clear all values from the 'curlsecurityblockedhosts' admin setting and save. (to permit localhost-to-localhost calls)

      Course setup

      1. Login to the tool site as the admin
      2. Create a course called 'tool course'
      3. Create an assignment in the course
      4. In another tab, login to the platform site as the admin
      5. Create a course called 'platform course'
      6. Enrol users s1, s2 and s3 into the course as students

      Site policy setup

      1. Login to the tool site as the admin
      2. Go to "Site admin > Users > Privacy and policies > Policy settings"
      3. Set "Site policy handler" to "Policies (tool_policy" and save
      4. Now, go to "Site admin > Users > Privacy and policies > Manage policies"
      5. Click "New policy"
      6. Enter all the required fields and set "Policy status" to "Active"
      7. Save the form

      LTI 1.3 setup

      1. Login to the tool site as the admin user
      2. Go to Admin > Plugins > Enrolment plugins > Publish as LTI tool > Tool registration
      3. Click to create a new registration
      4. Name the registration "platform site" and continue
      5. You'll see a dynamic registration URL. Click the "Copy to clipboard" icon to copy it
      6. Now, in another browser tab, login as the admin user to the platform site
      7. Go to to Admin > Plugins > Activities > External tool > Manage tools
      8. Paste the URL value into the "Tool URL" field
      9. Click "Add LTI Advantage"
      10. You should see a tool card now. Click "Activate" on it.
      11. Edit the tool (click the cog)
      12. Set:
        • "Name" to "Moodle LTI Advantage"
        • "Tool configuration usage" to "Show in activity chooser and as a preconfigured tool"
      13. Save the form
      14. Log out of the platform site

      Publish an activity and set up the resource link in the platform

      1. Login to the tool site as the admin user
      2. Go to the course
      3. From the course nav, select "More > Published as LTI tools"
      4. Click to publish a new resource
      5. Select the assignment in the "Tool to be published" field, leaving everything else alone
      6. Save
      7. Logout
      8. Login to the platform site in the new tab
      9. Go to the course
      10. Click to create an activity or resource
      11. Select the "Moodle LTI Advantage" activity tile
      12. If you're asked to link your account, follow the prompts to do so.
      13. When you're taken to the edit form, click "Select content"
      14. Click to bind your account with the admin account in the tool
      15. When you see the list of activities, select the assignment's "Add to course" (add to gradebook will be auto checked and that's ok)
      16. Click "Add content"
      17. When the modal closes, check the "Privacy" section of the form
      18. Make sure that all options are checked (accept grades, share names, share email)
      19. Save the activity instance
      20. Log out of the platform site
      21. Log out of the tool site now too - you'll have an existing session but you can trigger logout by visiting SITE/login/ - click Log out when prompted.

      Testing launch with active policy

      1. Login to the platform site as student s1
      2. Go to the course
      3. Click on the tool activity to launch into it
      4. Verify you're presented with a site policy which you must agree to
      5. Agree to policy and proceed
      6. Verify you're redirected to the assignment page without seeing any errors on the page
      Show
      Prerequisites You need two Moodle sites (localhost is fine) - one called 'platform' and one called 'tool' In the tool site admin settings: Enable enrol_lti and auth_lti plugins Enable "Allow frame embedding" In BOTH sites: Go to "Administration > Security > HTTP security" and clear all values from the 'curlsecurityblockedhosts' admin setting and save. (to permit localhost-to-localhost calls) Course setup Login to the tool site as the admin Create a course called 'tool course' Create an assignment in the course In another tab, login to the platform site as the admin Create a course called 'platform course' Enrol users s1, s2 and s3 into the course as students Site policy setup Login to the tool site as the admin Go to "Site admin > Users > Privacy and policies > Policy settings" Set "Site policy handler" to "Policies (tool_policy" and save Now, go to "Site admin > Users > Privacy and policies > Manage policies" Click "New policy" Enter all the required fields and set "Policy status" to "Active" Save the form LTI 1.3 setup Login to the tool site as the admin user Go to Admin > Plugins > Enrolment plugins > Publish as LTI tool > Tool registration Click to create a new registration Name the registration "platform site" and continue You'll see a dynamic registration URL. Click the "Copy to clipboard" icon to copy it Now, in another browser tab, login as the admin user to the platform site Go to to Admin > Plugins > Activities > External tool > Manage tools Paste the URL value into the "Tool URL" field Click "Add LTI Advantage" You should see a tool card now. Click "Activate" on it. Edit the tool (click the cog) Set: "Name" to "Moodle LTI Advantage" "Tool configuration usage" to "Show in activity chooser and as a preconfigured tool" Save the form Log out of the platform site Publish an activity and set up the resource link in the platform Login to the tool site as the admin user Go to the course From the course nav, select "More > Published as LTI tools" Click to publish a new resource Select the assignment in the "Tool to be published" field, leaving everything else alone Save Logout Login to the platform site in the new tab Go to the course Click to create an activity or resource Select the "Moodle LTI Advantage" activity tile If you're asked to link your account, follow the prompts to do so. When you're taken to the edit form, click "Select content" Click to bind your account with the admin account in the tool When you see the list of activities, select the assignment's "Add to course" (add to gradebook will be auto checked and that's ok) Click "Add content" When the modal closes, check the "Privacy" section of the form Make sure that all options are checked (accept grades, share names, share email) Save the activity instance Log out of the platform site Log out of the tool site now too - you'll have an existing session but you can trigger logout by visiting SITE/login/ - click Log out when prompted. Testing launch with active policy Login to the platform site as student s1 Go to the course Click on the tool activity to launch into it Verify you're presented with a site policy which you must agree to Agree to policy and proceed Verify you're redirected to the assignment page without seeing any errors on the page
    • 1

      Hello,

      When using LTI 1.3 course sharing between two Moodle 4.1.4 installations, first time the student opens the external tool it gives an error

      Coding error detected, it must be fixed by a programmer: se: Error: launch requires id_token
      Stack trace:
      line 61 of /enrol/lti/launch.php: coding_exception thrown
      

      at the same time browser console gives error;

      moodleaddress/enrol/lti/launch.php:1 GET https://moodleaddress.com/enrol/lti/launch.php 404 (Not Found)
      

      When the student opens the external tool activity for the second time it opens normally.

      Tested with two Moodles in version 4.1.4 (Build: 20230612)

      Steps to repeat:

      0. Add privacy policy to Moodle1 that everyone needs to confirm (use tool_policy as the site policy handler, then set a policy under 'manage policies')
      1. Establish LTI 1.3 connection with deeplinking between Moodle1 and Moodle2. Do not share user name or email information with LTI provider.
      1. Publish course1 from Moodle1 as LTI 1.3 advantage
      2. Add external tool to Moodle2 course and select course1 with content selection -button
      3. Open the external tool in Moodle2 as a student, notice how it does open Moodle1 but not the course.
      4. Accept the privacy policy
      5. Notice the error "Coding error detected, it must be fixed by a programmer: se: Error: launch requires id_token"
      6. Return to course front page
      7. Open external tool for the second time and notice how it works normally

        1. lti1.png
          lti1.png
          96 kB
        2. MDL-78578.png
          MDL-78578.png
          328 kB
        3. redirects_to_assignment.png
          redirects_to_assignment.png
          87 kB
        4. shows_policy.png
          shows_policy.png
          104 kB

            jaked Jake Dallimore
            urpokarhu Jari Vilkman
            David Woloszyn David Woloszyn
            Huong Nguyen Huong Nguyen
            Ron Carl Alfon Yu Ron Carl Alfon Yu
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - 0 minutes
                0m
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 3 hours, 15 minutes
                3h 15m

                  Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.