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.
LTI compliant example for consumer and provider
Asked Answered
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
I ported the omsmith code from CoffeeScript to normal JavaScript and put it on Packagist:
A Github Search yielded these sample Node LTI applications -
Hopefully one of them is useful to you.
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.
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()
© 2022 - 2024 — McMap. All rights reserved.