Discourse学习管理系统集成(LTI 1.3 认证)

:discourse2: Summary Discourse LTI allows Discourse to integrate with a number of learning management systems via the LTI 1.3 standard.
:open_book: Install Guide This plugin is bundled with Discourse core. There is no need to install the plugin separately.

This plugin implements the LTI 1.3 standard for authentication, which is supported by a number of learning management systems. Discourse acts as a “Tool” within the LTI standard. Once configured, users will be able to click a button/link on the learning management system, and instantly be logged into Discourse.

Precise setup instructions will vary based on your Learning Management System. But in general:

  1. Create a new “Tool” entry in your learning management system
  • LTI Version: 1.3
  • Launch URL: any URL on your site. Users will be directed here after login
  • Auth Request URL: https://<your-discourse-site>/auth/lti/initiate
  • Redirect URL: https://<your-discourse-site>/auth/lti/callback
  • Tool Public Key - leave blank. Discourse never sends data to the LMS
  1. In your LMS, find the 'Authorization endpoint", “Tool Client ID”, “Platform Issuer ID”, and the “Platform Public Key”, and add them to the relevant site settings in Discourse. In Discourse, the settings can be found by searching for lti in the Discourse site settings UI.

  2. If your learning management system guarantees User emails have been validated, enable the lti email verified site setting. :warning: Warning: If your LMS does not verify emails, enabling lti email verified is a security risk.

  3. Turn on the lti enabled site setting

If these instructions don’t make sense for your LMS, please post in the topic below and we’ll do our best to update the instructions accordingly.

What if my site is invite_required?

If you want your users to go through the Discourse invite redemption flow when they first log in, you can use LTI “Custom Properties” to specify a Discourse invite link. New users will be directed to the invite, while existing users will be sent to the regular launch URL. For example:

Property Name Property Value
discourse_invite_link https://discourse.example.com/invites/abcdefg

Last edited by @tobiaseigen 2025-07-16T21:17:34Z

Check documentPerform check on document:
22 个赞

您是否有关于将 LTI 集成与 Canvas LMS 集成的具体说明?

1 个赞

您需要由管理员来完成集成

我是我们的管理员之一,也是一名软件工程师。我认为我遇到的问题与 cookie 以及 Discourse 和 Canvas 之间的“状态”不匹配有关。

这是我在 Discourse 日志中看到的错误:

(lti) 身份验证失败!state_mismatch: StandardError, State 参数与会话不匹配

我认为该错误是从此处抛出的:discourse-lti/lib/discourse_lti/lti_omniauth_strategy.rb at main · discourse/discourse-lti · GitHub

有什么想法或可以帮助我调试的地方吗?在 Canvas 文档的此页面上:Overview of an LTI Launch <a name="launch-overview"></a> - Canvas LMS REST API Documentation

有一个“无 cookie 启动”部分,我认为这与此处相关。但我也不能 100% 确定。任何帮助或见解都将不胜感激。

我在 Canvas 中成功地让 LTI 正常工作了,但有一个注意事项。以下是我的步骤:

  1. 在 Canvas 中创建一个开发者密钥。您在 JWK 方法和公共 JWK 中填写什么并不重要

  2. 在 Discourse LTI 设置中,填写您的设置

  3. 对于公钥,您可以导航到 https://\u003cyour_canvas_url\u003e/api/lti/security/jwks 并复制第二个密钥。然后您可以转到 https://8gwifi.org/jwkconvertfunctions.jsp 并将其粘贴到其中进行转换。然后复制 -----BEGIN/END PUBLIC KEY----- 之间的文本,并将其粘贴到 Discourse LTI 设置中的LTI 平台公钥中。然后保存。

注意事项如下。Canvas 生成的 JWK 会被轮换,似乎是每月一次。一旦第二个密钥发生更改,LTI 将会中断,您需要按照步骤 3 替换为新的密钥。

Discourse LTI 插件必须支持公共 JWK URL 才能保持最新。

2 个赞

我可以将多个 LMS 集成到一个 Discourse 吗?

:partying_face: 此插件现已作为 Bundling more popular plugins with Discourse core 的一部分,与 Discourse 核心捆绑在一起。如果您是自托管用户并使用了此插件,则需要在下次升级前将其从 app.yml 中删除。

1 个赞