LTI compliant example for consumer and provider
Asked Answered
P

3

6

i'm looking for any code sample to integrate external tool to LMS using LTI in NodeJS but it seems quite hard to find working example. i have gone trough the sample provide by IMS Global but it's hard to understand. anyone having idea how to authorized app using LTI please share your code.

Phasis answered 4/5, 2017 at 6:47 Comment(1)
I have the same problem. It's a bit worrying when a global interoperability standard has little/no examples to be found on the web. Did you find an answer to your issue?Chipmunk
B
5

I ported the omsmith code from CoffeeScript to normal JavaScript and put it on Packagist:

https://github.com/tsugiproject/tsugi-node-lti

https://www.npmjs.com/package/tsugi-node-lti

Bruch answered 11/2, 2018 at 21:47 Comment(0)
M
2

A Github Search yielded these sample Node LTI applications -

schul-cloud/node-lti-provider

whitmer/lti_example

omsmith/ims-lti-example

Hopefully one of them is useful to you.

Mauritamauritania answered 23/10, 2017 at 21:8 Comment(0)
M
1

this is a little late but it might help someone else.

I have create a nodejs implementation of the Lti 1.3 advantage protocol that makes it super easy to setup a lti provider.

Ltijs

Here's a quick example of usage:

const path = require('path')

// Require Provider 
const Lti = require('ltijs').Provider

// Configure provider
const lti = new Lti('EXAMPLEKEY', 
            { url: 'mongodb://localhost/database', 
              connection:{ user:'user',
                          pass: 'pass'} 
            }, 
            { staticPath: path.join(__dirname, '/views/') })


let setup = async () => {
  // Configure main routes
  lti.appUrl('/')
  lti.loginUrl('/login')

  // Deploy and open connection to the database
  await lti.deploy()

  // Register platform
  let plat = await lti.registerPlatform(
    'http://platform/url', 
    'Platform Name', 'ClientIdThePlatformCreatedForYourApp', 
    'http://platform/AuthorizationUrl', 
    'http://platform/AccessTokenUrl', 
    { method: 'JWK_SET', key: 'http://platform/keyset' }
  )

  // Set connection callback
  lti.onConnect((connection, request, response) => {
    // Call redirect function
    lti.redirect(response, '/main')
  })

  // Set route accounting for issuer context
  lti.app.get('/:iss/main', (req, res) => {
    // Id token
    console.log(res.locals.token)
    res.send('It\'s alive!')
  })
}
setup()
Mercurochrome answered 6/7, 2019 at 20:26 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.