JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 3
  • Score
    100M100P100Q46261F
  • License ISC

A Canvas LTI 1.3 integration tool.

Package Exports

  • canvas-lti
  • canvas-lti/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (canvas-lti) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

canvas-lti | A Canvas LTI Integration Tool

This module provides an integration tool for Canvas LTI 1.3, facilitating the creation of Learning Tools Interoperability (LTI) applications with Canvas.

Features

  • OIDC initiation and LTI launch handling
  • Express middleware setup for easy integration to existing express applications
  • JWKS endpoint generation for RSA key signing

Installation

npm install canvas-lti

Basic Setup

const express = require('express');
const lti = require('canvas-lti');
const app = express();
const https = require('https');

lti.config({
    oidcInitiationUrl: 'https://your.canvas.domain/api/lti/authorize_redirect',
    clientId: 'your-client-id',
    baseURL: 'http://localhost:3000/',
    launchPath: 'launch',
    ltiPath: "/lti",
});

lti.expressInstance(app);

lti.on('launch', async (req, res) => {
    res.status(200).send('Your LTI tool has been successfuly launched!');
    // Any other logic you want can be added here.
});

lti.on('deeplink', async (req, res) => {
    if (req.deepLinkingRequest) {
        const item = [
            {
                "type": "ltiResourceLink",
                "title": "Title",
                "text": "Description text",
                "url": "https://localhost:3000/lti/deeplink"
            },
        ];
        lti.handleResponse(req, res, items);
    } else {
        // Handle the display of your content if it is not a deep linking request.
        res.status(200).send('This is not a deep link request.');
    }
});

app.listen(3000, () => {
    console.log('Server running on port 3000');
});

LTI configuration

The following items are required for this module to work correctly:

  • oidcInitiationUrl: This is the URL of your canvas installation with /api/lti/authorize_redirect appended ot the end.
  • clientId: This is the client ID of the developer key for this integration within Canvas.
  • baseURL: The base url of your application.
  • launchPath: The launch path of your application. Do not include the LTI path as it will be added before your launch path.
  • ltiPath: The path for all LTI related routes within your LTI application. It can contain leading or trailing "/" or no backslashes.

JWKS endpoint

This module automatically creates a JWKS endpoint based on the ltiPath configuration. If it needs to be accessed, it can be found at <ltiPath>/.well-known/jwks.json.

Canvas-LTI will generate an RSA key pair and save them as "private.key" and "public.key". The public JWK is then created off of the public key. This ensures that deeplinking requests are properly authenticated and handled by Canvas.

Issues

This library is still a work in progress. More detailed guides and issue reporting is in the works. For immediate issues, please email hep21001@byui.edu.