packbackbooks / lti-1-3-php-library

A library used for building IMS-certified LTI 1.3 tool providers in PHP.
Apache License 2.0
39 stars 25 forks source link

buildUrlWithQueryParams includes duplicate keys #143

Closed KilianSL closed 4 months ago

KilianSL commented 4 months ago

I am attempting to build a simple LTI test tool using this library and the IMS test tool that leveraged the original lti-php lib, however am running into some issues with generating the redirect url on LTI launch.

My current launch implementation, shown below, correct parses a launch link and redirects to the target fusionauth instance, however it produces an invalid OAuth request, with the client_id key and value duplicated, and two different redirect_uri.

The $authParams object in getRedirectUrl does not contain the duplicate keys, so it must follow that they are somehow making their way into the URL in the buildUrlWithQueryParams()function.

Login Implementation

$authLoginUrl = LtiOidcLogin::new(new Lti13Database(), new Lti13Cache(), new Lti13Cookie())
    ->getRedirectUrl("http://localhost:9001/game.php", $_POST);

header('Location: ' . $authLoginUrl, true, 302);
exit();

**Generated Redirect URL:***

http://localhost:9011/oauth2/authorize?client_id=...&client_id=...&response_type=code&response_type=id_token&redirect_uri=http://localhost:9001 &redirect_uri=http://localhost:9001/game.php&scope=openid&response_mode=form_post&prompt=none&state=*&nonce=...&login_hint=...

For additional context, our fork of the LTI tool can be found here.

KilianSL commented 4 months ago

Closed as the error was not related to package.