Giter Site home page Giter Site logo

mit-teaching-systems-lab / discourse-edx-lti Goto Github PK

View Code? Open in Web Editor NEW
22.0 4.0 6.0 2.37 MB

Discourse plugin for using Discourse as a discussion forum in EdX courses

Home Page: http://tsl.mit.edu

License: MIT License

Ruby 100.00%
edx edx-platform edx-course lti-provider discourse-plugin forum-site

discourse-edx-lti's Introduction

discourse-edx-lti

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.

Where has this been used?

Learner user experience

1. Learner signs into EdX

login

2. Within EdX course, learner launches Discourse with LTI

login

3. The learner is authenticated with their EdX username

login

4. The Discourse instance is private

login

5. Login button links back to EdX course or allows admin login

login

Course author user experience

1. In Studio's Advanced Settings, enable LTI and add LTI passport (see EdX docs)

login

2. Add a new LTI widget

login

3. Set the LTI URL to /auth/lti/callback always

login

4. Set the LTI Custom Parameters to include ["url=/page-to-link-to"]

Note that this may be handled differently on edX versus an Open edX instance. See #22 for more. login

5. Set the LTI Launch Target to open in a new window

login

Setup

Initial setup for new course forums

Install and setup this plugin

  • 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).

Discourse plugin setup

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

EdX course setup

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

Configure your Discourse forums

Local development

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.

discourse-edx-lti's People

Contributors

kevinrobinson avatar zimka avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

discourse-edx-lti's Issues

Custom redirect url not working since Discourse 2.4.0

Hi,
Since Discourse updated to v2.4.0, the custom url parameter to redirect users after login doesn't seems to work anymore.

Here's the POST request parameters :

resource_link_id=e09c86b8406648b2bc87dc611ff7e8f1
[email protected]
user_id=88c71f99e4a0e0474b5b130359f680ea
roles=Instructor
oauth_nonce=40036430943264592951584955216
oauth_timestamp=1584955216
lis_result_sourcedid=course-b2bc87dc611ff7e8f1:88c71f99e4a0e0474b5b130359f680ea
context_id=course-v1
oauth_consumer_key=6f045120e1d051a592233ae4f6018ae2a5b81e650ba2d037e693e8b3f4c2aa
lti_version=LTI-1p0
oauth_signature_method=HMAC-SHA1
custom_url=https://my-forum.com/mooc/c/module-1-category
oauth_version=1.0
launch_presentation_return_url
oauth_signature=lLUu3C9m3KTIj/AGeRddKkZdys8=
lis_person_sourcedid=brospars
lti_message_type=basic-lti-launch-request
oauth_callback=about:blank

The response is a 302 and contains location=https://my-forum.com/ instead of the expected location=https://my-forum.com/mooc/c/module-1-category

I downgraded to v2.3.0 and everything works as expected. I've searched in the changelog but no luck. Any ideas ?

OmniAuth/Other LMS tools

Hi,

I am looking to adapt what you have created here and build a more generic LTI tool to make it available from other LMS tools. I can get the launch to work, but get the "oops this page does not exist" errors.

What I am trying to figure out from the code is how the omniauth is triggered and on what side? Is that triggered from edX or from discourse and would discourse therefore need omniauth plugin installed as a requirement?

Dan

Lms IFrame rendering error "Load denied by X-Frame-Options: ... does not permit cross-origin framing."

Hello!
I tried to set up discourse as edx forum and faced next problem: while oauth goes well and right page is returned from discourse in response, it is not rendered in lms with error "Load denied by X-Frame-Options: ... does not permit cross-origin framing."

As I see in edx course, Discourse is not intended to be rendered into IFrame, moreover, it is not supported by Discourse itself.

Could this error be due the wrong version lti-consumer? I use eucalyptus.1 edx instance with 1.0.9 lti-consumer.
Could you specify which edx release and lti-consumer are required/ were tested?

Reports on courses that have used discourse?

Hey,

This looks great! Do you have any reports from past/current courses about how using Discourse went?
We were chatting about the next run of our MOOC and said "I wonder if we could use Discourse...", so I'm pleased to see MIT has already solved the problem, as usual! :)

"400 bad request" when open Discourse site

There is a “400 bad request” error when opening Discourse page from LIT component in my course that run within my Open edX site.

Version of Discourse: Open edx version: Ginkgo ,Discourse version: v1.9.0.beta14

3 relevant details are as following:

Detail 1/3: Screenshot of the error
image

Detail 2/3: the code line where I think the program stopped

Detail 3/3: The problematic request.params is printed as following
{"resource_link_id"=>"pd.lh4cs.org-acb63f37ee1945b3b32d5a8127696039", "lis_person_contact_email_primary"=>"[email protected]", "user_id"=>"8c7c5a3defcc8df089b41bfd3ad1d695", "roles"=>"Student", "oauth_nonce"=>"88971414880083225381511140253", "oauth_timestamp"=>"1511140253", "lis_result_sourcedid"=>"course-v1%3AUVa%2Blh4cs01%2B2018_T1:pd.lh4cs.org-acb63f37ee1945b3b32d5a8127696039:8c7c5a3defcc8df089b41bfd3ad1d695", "context_id"=>"course-v1:UVa+lh4cs01+2018_T1", "oauth_consumer_key"=>"x123456-d87f-3838-cop.lh4cs.org", "lti_version"=>"LTI-1p0", "oauth_signature_method"=>"HMAC-SHA1", "oauth_version"=>"1.0", "launch_presentation_return_url"=>"", "custom_["=>"https://cop.lh4cs.org/c/lighthouse-cc", "oauth_signature"=>"o3eSM/f0+6BmFvcN/C5/SYpcrP0=", "lis_person_sourcedid"=>"aihua", "lti_message_type"=>"basic-lti-launch-request", "oauth_callback"=>"about:blank"}

--End--

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.