This is a Discourse plugin for using Discourse as a discussion forum in EdX courses.
It adds a Discourse AuthProvider
that handles LTI authentication from EdX. This allows one-click navigation from an EdX course into the discussion forum. The login dialog also allows users to bounce back to the course, and Discourse admin users can sign in directly.
Alternately, you may be interested in a similar project using WordPress as a discussion forum for EdX courses.
- MIT: Design Thinking for Leading and Learning (course report)
- MIT: Launching Innovation in Schools, also on EdX Edge for a white-labeled small private online course
1. In Studio's Advanced Settings, enable LTI and add LTI passport (see EdX docs)
Note that this may be handled differently on edX versus an Open edX instance. See #22 for more.
- This repository assumes you've already done this. See mit-teaching-systems-lab/discourse-for-moocsters for setup instructions for how we do this in our labs at MIT.
- The intent is that the site is private, and learners can only gain access by signing in through EdX and launching the site through LTI. Admin users sign into Discourse directly.
- To do this, the plugin sets some admin site settings related to users and login, which you can see in config/settings.yml. You can edit these in the Discourse Admin UI, but note that the interactions between these settings in different parts of the product are complex, and we don't recommend changing these defaults.
- Install this repository as a Discourse plugin (instructions)
- Rebuild container
- Test! Logout from your admin user, and click the Login button. You should see a
Login with EdX
button at the top of the Login dialog box (which won't work yet).
- Pick an id for the forum site, generate a consumer key and secret
- In Discourse, visit
Admin
->Plugins
->discourse-edx-lti
- Set the LTI consumer key and secret, and the EdX course URL that has the LTI button to the forums.
- In EdX Studio, visit
Settings
>Advanced settings
- Add "lti" and "lti_consumer" to
Advanced Module List
- Add the forum site's id, consumer key and consumer secret to
LTI Passports
- In Studio, add an LTI Consumer. Set the LTI id, and set the LTI URL to
/auth/lti/callback
on the Discourse forum domain. We typically set the LTI Launch Target to "New Window". - For the LTI Consumer, make sure to set "Request users' username" and "Request user's email" to
true
. You may need to reach out to someone at EdX to enable this for your course.
You can develop with Vagrant (see Discourse docs). As you develop, clear the ERB cache, copy this repository to the plugins
folder and restart Rails to see changes.
Example:
rm -rf tmp/cache && \
rm -rf ./plugins/discourse-edx-lti/ && \
rsync -av --exclude .git \
~/github/mit-teaching-systems-lab/discourse-edx-lti \
./plugins/ && \
vagrant ssh -c 'cd /vagrant && bundle exec rails s -b 0.0.0.0'
The plugin-third-party.js.erb
file is what ultimately injects the JavaScript needed to show the new login button in the UI. In development mode, this file will be cached and won't updated if you are rebuilding the plugin on each change. You can touch it manually or just clear the ERB cache on each change (like above). See https://meta.discourse.org/t/tmp-cache-needs-to-be-manually-cleared-when-developing-plugins/17109 or sstephenson/sprockets#563 for other alternatives.