Install & Setup

1. Install Lumi Education H5P SDK

Install our Javascript SDK to get started. Use the following code in your application wherever the user will view or create/edit H5P content.

<script src="https://api.Lumi.education/sdk.js" type="text/javascript"></script>

This script will add a global Lumi object to the window object, which can be called via window.Lumi

2. Identify users via SSO-Token

These are instructions on how to generate Single Sign-On tokens on your server. These tokens can be used to authenticate your users in our SDK. You can find the required private API key at https://app.Lumi.education/dashboard/user/api

  • Store your private key on your server and don't share it.

  • When a user wants to use the widget, request your server to generate an SSO token.

  • On your server, generate a token using the snippet below.

  • Pass the token back to your app and into our widget.

  • We will use that token to authenticate your user.

2.1. Install a JWT library

We use JSON Web Tokens to securely authenticate your users. First, install the appropriate JWT library for your server.

npm install --save jsonwebtoken

2.2. Generate tokens on your server

var jwt = require('jsonwebtoken');

var PrivateAPIKey = <privateAPIKey>; // private API key is found on https://app.Lumi.education/dashboard/user/api

function createLumiToken(user) {
  var userData = {
    id: user.id,
    // These are optional
    username: user.username,
    email: user.email,
    imageUrl: user.imageUrl
  };
  return jwt.sign(userData, PrivateAPIKey, {algorithm: 'HS256'});
}

For demonstration purposes, you can also generate an SSO-Token at https://app.Lumi.education/dashboard/user/api

3. Initialise the SDK

To initialize the SDK you have to call the init-method on the global Lumi-object with the appId and SSO-token as arguments:

Lumi.init(<appId>, <SSO-token>);

You can find the appId on https://app.Lumi.education/dashboard/user/api. To create an SSO-Token please follow Identify users via SSO-Token.

Last updated