The Instructure Community will enter a read-only state on November 22, 2025 as we prepare to migrate to our new Community platform in early December.
Read our blog post for more info about this change.
Found this content helpful? Log in or sign up to leave a like!
Hi,
I have been banging my head against the wall for quite a few days now not being able to find a solution for this when I was hoping it would be quite simple.
I would like to create a php page that validates the signature that is returned from Canvas when calling my LIT.
I have managed to generate an OAuth signature but they don't seem to match.
I have tried several OAuth Libraries but nothing seems to get the signature correct.
Is there a preferred method or a know working example of php based code that will successfully validate the returned signature?
Thanks!
Solved! Go to Solution.
Were you able to find an answer to your question? I am going to go ahead and mark this question as answered because there hasn't been any more activity in a while so I assume that you have the information that you need. If you still have a question about this or if you have information that you would like to share with the community, by all means, please do come back and leave a comment. Also, if this question has been answered by one of the previous replies, please feel free to mark that answer as correct.
Robbie
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!
Hi @kheading ,
I saw that your question has stumped the community just a tad. Have you managed to make any further progress on this yourself since your last post? Or are you still looking for some help?
Cheers,
Stuart
Hi Stuart,
I haven’t worked this out no.
I have been busy with other things but would really like to pick this up again soon.
It’s a bit frustrating there isn’t any decent documentation on how to get it done.
I will post an update here if I event manage to fix it.
Thanks!
Hi @kheading ,
No worries at all, I will admit I haven't used oAuth from a development perspective before. I did have a look in the official Instructure GitHub repository which referenced the following Ruby Client GitHub - oauth-xx/oauth-ruby: OAuth for Ruby, not sure if you have any Ruby experience but considering this was forked into Instructure's GitHub repo, it may be worth a look (depending on if you have oAuth experience).
I have also had a peruse through the Instructure Repo and found a couple of others that may be of benefit to have a look at and (hopefully) point you in the right direction:
While these two are heavily Ruby based, there may be some useful details in getting one of them up and running to try to overcome your issue (or understand if there is a logic difference in what you are attempting.
Alternatively, hoping now this is back near the recent posts that someone else with a little oAuth knowledge may be able to jump in, but hope I have at least provided a couple of other avenues for you to look into.
Cheers,
Stuart
Any news on how to create this integration in php?
Were you able to find an answer to your question? I am going to go ahead and mark this question as answered because there hasn't been any more activity in a while so I assume that you have the information that you need. If you still have a question about this or if you have information that you would like to share with the community, by all means, please do come back and leave a comment. Also, if this question has been answered by one of the previous replies, please feel free to mark that answer as correct.
Robbie
Community helpTo interact with Panda Bot, our automated chatbot, you need to sign up or log in:
Sign inTo interact with Panda Bot, our automated chatbot, you need to sign up or log in:
Sign in