cancel
Showing results for 
Search instead for 
Did you mean: 
marchermon
Surveyor

Maintaining LTI connection when reloading tool

Hello, I am the Canvas LMS Manager for my school district and I know PHP and MySQL but have just started dabbling in building LTI tools. I recently forked the Basic LTI Tutorial Using PHP 
and was pretty excited to get some basic tools to embed into Canvas and be able to use the Users information. They were fairly rudimentary tools. Currently, I started writing a slightly more involved tool and have run into a problem that is probably an easy fix for someone who knows what they are doing. (not me!) The tool is still just a one page PHP page but it submits a form back to itself and enters some data into a database and then reloads the page to show the changes. Upon reload of the page however it will drop down to the "This was not a valid LTI launch". I'm assuming I need to store something in a session or something? Basically, if I have an entire tool with several PHP pages how do I maintain the connection? I've been googling the last three days on this and have tried a million things but now am just willing to acknowledge my stupidity with this and reach out and see if anyone can get me a little farther down the road. Thanks.

Tags (3)
0 Kudos
1 Reply
svickers2
Surveyor

LTI effectively replaces the login page you might have to authenticate a user into a web application (tool).  Once the LTI launch message has been verified it is then up to the tool to establish a session to maintain an ongoing connection with the user; LTI is only used after that for making service requests (or for returning content items when using the deep linking message type).  Especially for LTI versions prior to LTI 1.3 you may find the best practice guide at http://celtic.lti.tools/wiki/LTI/Best_Practice a useful reference.

The open source PHP LTI library from the ceLTIc Project (https://github.com/celtic-project/LTI-PHP/) provides all the code required for handling the message verification and service requests, and also has a sample tool (Rating) to illustrate its use.  So if your needs grow you may find this useful.