lti1p1-launcher
v1.0.2
Published
A self contained client-side launcher for LTI 1.1 content
Maintainers
Readme
LTI1.1 launcher
This package is a simple LTI launcher that performs a basic launch using an LTI launch URL, key and secret.
Setup
npm install lti1p1-launcherThis package assumes there is an iframe available that will be used to embedd the LTI content that is being launched.
Make sure to have the iframe on the page with a valid id
<iframe id="contentFrame"></iframe>Usage
- Import the Launcher
import Launcher from 'lti1p1-launcher'- Call the
setup()function
const iframeQuerySelector = '#contentFrame';
const launchUrl = 'https://platform.com/lti/...';
const key = '...';
const secret = '...';
const userId = '...'
let launcher = Launcher.setup(iframeQuerySelector, launchUrl, key, secret, userId);- (optional) Set optional parameters
launcher
.withUserInfo('firstName', 'lastName', 'displayName', 'email')
.withLanguage('en')
.withResultCallback('callbackUrl', 'sourcedId')- Perform the launch
launcher.launch()Best practice
In single page applications it is recommended to unset the source of the iframe when navigating away from the page that contains the iframe.
This allows the embedded content to correctly end the active session on their side.
iframe.src = 'about:blank'