Skip to content

Testing LTI integration with Canvas

cjcolvar edited this page Aug 23, 2017 · 9 revisions

This guide will walk you through how to setup the Canvas Learning Management System (LMS) and configure your Avalon development environment in order to test integration through LTI (Learning Tools Interoperability).

Setup Canvas with Docker

docker run -d --name canvas-docker -p 80:3000 -d lbjay/canvas-docker

Configure Avalon LTI Authentication

  1. Uncomment the LTI authentication block under development in config/authentication.yml so it looks like:
    - :name: Avalon Lti OAuth
      :provider: :lti
      :hidden: true
      :params:
        :oauth_credentials:
          key: 'secret'
    
  2. Create your own key/secret pair in config/authentication.yml to replace key: 'secret'
  3. Start your rails server: bundle exec rake hydra:server

Configure Canvas for Avalon

  1. Login to Canvas The Canavs docker container has default credentials of [email protected] / canvas-docker
  2. Create a Course Click Start a New Course and fill out the form
  3. Setup an External Tool
    1. In the new course, go to Settings
    2. Click the Apps tab
    3. Click the +App button
    4. Fill out the form with a name, the key/secret pair you made before, and a Launch URL that points to your Avalon instance: http://127.0.0.1:3000/users/auth/lti/callback
  4. Add the External Tool to a Module
    1. Go to Modules
    2. Create a new Module
    3. Click the + button within your new module
      1. Select External Tool from the dropdown menu
      2. Fill in the Launch URL from above and give it a name
      3. Click Add Item

Configuration of Avalon LTI

  1. Click on the new item inside the module created
  2. Look in the rails log for the request logging and find tool_consumer_instance_guid:
    Started POST "/users/auth/lti/callback" for XXX.XXX.XXX.XXX at 2017-08-23 15:39:18 -0400
      ActiveRecord::SchemaMigration Load (0.1ms)  SELECT "schema_migrations".* FROM "schema_migrations"
     (lti) Callback phase initiated.
    Processing by Users::OmniauthCallbacksController#lti as HTML
      Parameters: {"oauth_consumer_key"=>"fluorine", "oauth_signature_method"=>"HMAC-SHA1", "oauth_timestamp"=>"1503517158", "oauth_nonce"=>"m4TOyaq7EfisyxfO0t1Ws6WBY8ZHllJoL7IjbFpRo", "oauth_version"=>"1.0", "context_id"=>"4dde05e8ca1973bcca9bffc13e1548820eee93a3", "context_label"=>"Course", "context_title"=>"Course LTI Test", "custom_canvas_enrollment_state"=>"active", "ext_roles"=>"urn:lti:instrole:ims/lis/Administrator,urn:lti:instrole:ims/lis/Instructor,urn:lti:role:ims/lis/Instructor,urn:lti:sysrole:ims/lis/SysAdmin,urn:lti:sysrole:ims/lis/User", "launch_presentation_document_target"=>"iframe", "launch_presentation_locale"=>"en", "launch_presentation_return_url"=>"http://localhost/courses/1/external_content/success/external_tool_redirect", "lti_message_type"=>"basic-lti-launch-request", "lti_version"=>"LTI-1p0", "oauth_callback"=>"about:blank", "resource_link_id"=>"6a8aaca162bfc4393804afd4cd53cd94413c48bb", "resource_link_title"=>"Avalon", "roles"=>"Instructor,urn:lti:instrole:ims/lis/Administrator", "tool_consumer_info_product_family_code"=>"canvas", "tool_consumer_info_version"=>"cloud", "tool_consumer_instance_contact_email"=>"[email protected]", "tool_consumer_instance_guid"=>"794d72b707af6ea82cfe3d5d473f16888a8366c7.localhost:3000", "tool_consumer_instance_name"=>"Canvas Docker", "user_id"=>"535fa085f22b4655f48cd5a36a9215f64c062838", "oauth_signature"=>"wfFeHrWuRtQRvEpCun3oexjmtDU="}
    Attempting to find user with lti strategy
    
  3. Copy config/lti.yml.example to config/lti.yml
  4. Edit config.yml replacing <lms guid> with the tool_consumer_instance_guid found above and with the settings below:
    794d72b707af6ea82cfe3d5d473f16888a8366c7.localhost:3000:
      :uid: :tool_consumer_instance_contact_email
      :email: :tool_consumer_instance_contact_email
      :context_id: :context_label
      :context_name: :context_label
    
  5. Restart the rails server

Test