celtic-project / LTI-PHP

PHP class library for building LTI integrations
GNU Lesser General Public License v3.0
47 stars 37 forks source link

GET as Login Initiation URL #59

Closed zoehler closed 11 months ago

zoehler commented 1 year ago

Hey guys, how are you?

I'm facing some issues trying to integrate my provider tool with Blackboard using LTI 1.3.

Looks like Blackboard sends a GET request to the Login Initiation URL and i'm facing the following error: image

As you can see my code is very simple, i'm just trying to authenticate and send a Hello World.

I've managed to develop a function to authenticate by the GET request but this way I can't use any of the lib functions: image

Here is the Blackboard documentation: https://docs.anthology.com/docs/LTI/Tutorials/lti-lti_impl_guide#lti-launch

There is any way to use CeLTIc to authenticate on a GET request?

Thanks in advance!

chrispittman commented 1 year ago

To clarify this a tiny bit, he's using the laravel-celtic-lti library, which is just a lightweight wrapper around this one. LtiTool::getLtiTool() just returns an instance of Celtic\LTI\Tool, and from then on he's using the CeLTIc functions natively.

spvickers commented 1 year ago

The library should handle initiate login requests via both GET and POST. Either the library is not recognising the message correctly (which is does by looking for a parameter named "iss", see line 491 of Tool.php) or it is the Laravel wrapper which is causing this. Are you able to share the request you are receiving from Blackboard? Thanks.

zoehler commented 1 year ago

Hey guys! Sorry for the long wait, had been a rough week.

Here is the request info that Blackboard sends to the tool provider: image

Payload: image

And here is the error: image

spvickers commented 1 year ago

Thanks for the details. The iss parameter is being passed in the request so I do not understand why the code at line 491 is not identifying it as an Initiate Login request. Which version of this library are you using?

zoehler commented 1 year ago

Actually i'm using the longhornopen/laravel-celtic-lti v0.4.8, but i didn't found the CeLTIc lib version that it uses.

My next step should be trying to use directly the celtic-project/LTI-PHP lib in my project to see if I can integrate with Blackboard.

spvickers commented 1 year ago

OK. If you are able to add some code to the library file then try adding these lines to the handleRequest method in Tool.php after the "$parameters = Util::getRequestParameters();" line:

    error_log('$_GET: ' . var_export($_GET, true));
    error_log('$_POST: ' . var_export($_POST, true));
    error_log('parameters: ' . var_export($parameters, true));

Then share the lines added to the PHP error log file when you replicate the error. I am wondering whether the Laravel framework makes changes to the $_GET and/or $_POST global variables which may be causing your issue.

chrispittman commented 1 year ago

I am wondering whether the Laravel framework makes changes to the $_GET and/or $_POST global variables which may be causing your issue.

It doesn't. All the $_ variables are still available as you'd expect.

spvickers commented 1 year ago

Thanks for the confirmation, then hopefully your error log entries will explain why your system is not finding "$parameters['iss']" in the handleRequest method (assuming you are using a version of the ceLTIc library which includes this support - the check is on line 491 in version 4.10.3).

chrispittman commented 1 year ago

To be clear, I'm not the one experiencing the problem, @zoehler is. I just provide a thin wrapper around this library to make it easier for developers using Laravel to instantiate ceLTIc's PHP objects and database tables correctly.

I also can't explain why his query string parameters are seemingly going missing; I can't think of a way that either of our libraries would be causing that. I've given him some instructions over in the longhornopen/laravel-celtic-lti project how to use this library natively and cut our Laravel wrapper out of the loop as a test.

spvickers commented 1 year ago

Has a solution been found to this issue?

zoehler commented 1 year ago

Hello Stephen, I've put this task on hold, so for now it haven't been solved.

I'm planning on returning on this issue soon, this week or next one. I'm gonna reset my project and start a new one from scratch using the CeLTIc lib.

Any update i'll post here, thanks for the support!

spvickers commented 1 year ago

Thanks for the update @zoehler, I'll leave this issue open in the meantime and hope for a successful resolution.

spvickers commented 11 months ago

Closing this issue now; just create a new one if you still need assistance.