Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Option for custom context on serverless Express server #223

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

dmolin
Copy link

@dmolin dmolin commented May 8, 2024

When using the servless options, LTIJS defaults to the requester baseUrl and its "/" context when redirecting back to our application. This makes it impossible for this to work in situations where we want LTIjs to use a separate context from the one used by the main web application.

This PR makes it possible to specify a custom context that will be used by the Express server when dealing with LTIjs messaging.

Example usage:

  provider = Provider.setup(
    ltiSignKey,
    {
      url: ltiDB
    },
    {
      // options
      tokenMaxAge: 60 * 60, // 1 hour
      appRoute: "/launch",
      loginRoute: "/login",
      cookies,
      dynRegRoute: "/register",
      dynReg: {
        url: `${settings?.public?.baseUrl}/ltitool`,
        name: `${settings?.private?.lti?.toolName || "LTI Tool"}`,
        description: `${settings?.private?.lti?.toolDesc || "LTI Tool Description"}`,
        redirectUris: [],
        autoActivate: true
      }
    },
    log
  );

  // deploy the LTI provider in serverless mode and bind it to the context '/ltitool'
  await Provider.deploy({ serverless: true, path: "/ltitool" });

This will result in "/ltitool/launch", "/ltitool/login", "/ltitool/register" to be used by the Express server as intended.

…a serverless LTI setup

update built file and package-lock
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant