Hi Peter,
Thanks for sharing the links, I had tried a few of these. the issues is at the moment im not sure how to pass the OAuth parameters to the tool for it to verify.
This is my current code and it gets as far as printing the error so I know its at least calling the class, but fails to print any error.
foreach($_POST as $key => $item){
print_r($key . ' : ' . $item . '<br>');
if(stripos($key, 'OAuth')){
$OAuthData[$key] = $item;
}
}
use IMSGlobal\LTI\ToolProvider;
$consumer = new ToolProvider\ToolConsumer('testing.edu');
$consumer->name = 'Testing';
$consumer->secret = 'SECRETPASSWORD';
$consumer->enabled = TRUE;
class App1ToolProvider extends ToolProvider\ToolProvider {
function onLaunch() {
// Insert code here to handle incoming connections - use the user,
// context and resourceLink properties of the class instance
// to access the current user, context and resource link.
print_r('LAUNCH SUCCESS');
}
function onError() {
// do something
print_r('ERROR :' . $this->reason . '</br>' );
return true;
}
}
$tool = new App1ToolProvider(NULL);
$tool->handleRequest();
print_r($_POST);
the result im getting is....
oauth_consumer_key : 0987654321
oauth_signature_method : HMAC-SHA1
oauth_timestamp : 1512452771
oauth_nonce : LMmi6SLfheImrIhvWtoeyeVpFjrvccZscokl2GyjKuk
oauth_version : 1.0
context_id : 84b2497a2f2de6843ccd63ba42260012ed0a1179
context_label : TEST
context_title : TEST - Pages
*/ DATA REMOVED */
ext_roles : urn:lti:instrole:ims/lis/Administrator,urn:lti:instrole:ims/lis/Instructor,urn:lti:instrole:ims/lis/Student,urn:lti:role:ims/lis/Instructor,urn:lti:role:ims/lis/Learner/NonCreditLearner,urn:lti:role:ims/lis/Mentor,urn:lti:sysrole:ims/lis/User
launch_presentation_document_target : iframe
launch_presentation_height : 400
launch_presentation_locale : en-AU
launch_presentation_return_url : */ DATA REMOVED */
launch_presentation_width : 800
lti_message_type : basic-lti-launch-request
lti_version : LTI-1p0
oauth_callback : about:blank
resource_link_id : 84b2497a2f2de6843ccd63ba42260012ed0a1179
resource_link_title : DEV
roles : Instructor,urn:lti:instrole:ims/lis/Administrator
tool_consumer_info_product_family_code : canvas
tool_consumer_info_version : cloud
tool_consumer_instance_contact_email : notifications@instructure.com
tool_consumer_instance_guid : 4FanjgHyUlWLdb8Js7qegOANBotb65dMMzCA98ID:canvas-lms
tool_consumer_instance_name : Walford Anglican School for Girls
user_id : 9332fc84ff99ee2cc323146889b7a365c04f3f6b
oauth_signature : nm/Vvh2iwxUsa5E1QCrnf9AESkg=
ERROR :
Any help is greatly appreciated
Thanks!