Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@jazahn
Created June 15, 2015 16:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jazahn/1429a1072c04b51f9406 to your computer and use it in GitHub Desktop.
Save jazahn/1429a1072c04b51f9406 to your computer and use it in GitHub Desktop.
sample of ims-lti for node
var https = require('https');
var fs = require('fs');
var express = require('express');
var app = express();
var lti = require('ims-lti');
var ssl_options = {
key: fs.readFileSync(__dirname + '/ssl/localhost.key'),
cert: fs.readFileSync(__dirname + '/ssl/localhost.crt'),
requestCert: false,
rejectUnauthorized: false
};
var consumer_key = "key";
var consumer_secret = "secret";
app.post('/launch_lti', function(req, res){
var provider = new lti.Provider(consumer_key, consumer_secret);
provider.valid_request(req, function(err, isValid) {
console.log(err);
res.send("valid_request? " + isValid);
});
});
var server = https.createServer(ssl_options, app).listen(3001, function(){
console.log("https server started at port 3001");
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment