-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Question] Incorrectly Invalid Signature #21
Comments
The most likely cause is that the URL of your endpoint as seen by your app is not the same as the URL used by the sender because of some mapping happening on the server. For example, rather than https://your.server.com/launch (as used by the Tool Consumer) your code is detecting the URL as being something else like https://your.server.com/lti/launchapp.php. If you set the logging level to debug I think you may get the OAuth basestring logged so you can check this. |
As well as altering your code, you can also set the logging level to debug by including a custom parameter in the launch named "debug" (passed as "custom_debug") with a value of "true". |
Interesting. I'll spend some time looking at that base string more deeply. When I looked at the base string, the URL endpoint looked identical (save for url encoding):
So... I have to admit, the thing that confuses me the most at the moment is that the signature I built on the tool provider end with my hack (
I think I need to remove the Heroku question mark from my testing, so I'll set up a test on a non-Heroku domain to see if I can get it to work. |
OK, so it looks like my hunch was not the reason. When you turned on debug-level logging did you get any more detailed error message to give further hints at the cause. You can use a tool like the one at https://lti.tools/oauth/ to check the calculation of the signature; let me know if it looks like the signature generated from the base string reported from the LTI library being used by your tool provider does not agree with the one generated elsewhere and I shall investigate further. If you are able to provide a full base string and shared secret so I can check it myself that would be very helpful. You can send it to me at stephen at spvsoftwareproducts.com if you prefer not to post it here. Is the tool consumer you are using IMS certified? |
Yup, they're certified. I'll email you the base string and secret in a moment. Thank you so much! |
Closing this out by noting (with many thanks to Stephen for helping figure this out), that one can only have the DataConnector auto-detect your database if you use the factory method, not the constructor. Super important to create the DataConnector thus: $pdo = new PDO( /* ... as one does ... */ );
$works = DataConnector::getDataConnector($pdo); // <-- the RIGHT way
$fails = new DataConnector($pdo); // <-- the WRONG way Calling the DataConnector constructor creates a generic DataConnector that fills in default values for things like, say... secrets. |
Thanks @battis, I shall reflect on this and see if I can remember why this behaviour exists and perhaps update the code accordingly. |
I suspect, in your case, you could also have done something like this:
The static method (getDataConnector) will work out which class to create for you, but you can also do this directly. |
Yes, that would have worked too. (Really, what I should have done in that case was |
I plan to change the constructor method for the DataConnector object to be protected (rather than public) in the next release to avoid this issue in future. |
Thanks for this answer! It had taken me hours tracking down the "invalid signature" issue in |
Glad to hear you have now got to the bottom of this. |
I'm running into a strange error. I'm running my Tool Provider on Heroku (although I think that may be irrelevant — I mention it only because of the way they handle SSL connections on free apps), and when I make an LTI launch request from my Tool Consumer (Blackbaud's learning management system, in this case), I find that the OAuth Signature is failing its checks and being flagged as invalid.
I went through a bunch of gyrations making sure that I wasn't having some sort of timezone/timestamp disconnect, and have both the tool consumer and tool provider in the same timezone, with timestamps ~1 second apart (depending on when checked, I suppose). Double-checked that everyone was using the same key/secret combination.
Having dug around for a while in PHP-LTI code, I slapped together the below. Which makes me think that I'm experiencing Schrödinger's OAuth signature: it is both valid (using my hacked together check) and invalid (when processed by
$tool->handleRequest()
).Any perspective on what might be going wrong? Any insights/redirects would be much appreciated! Thanks!
And I'm seeing results like this:
The text was updated successfully, but these errors were encountered: