When responding to a deep link request the following error is thrown:
Warning: openssl_sign(): Supplied key param cannot be coerced into a private key in /vendor/firebase/php-jwt/src/JWT.php on line 225
Sample code which retrieves a deep-linking launch request from the cache, sets up a resource response, and attempts to generate a deep link response formatted as a JWT.
// assume $launchId, $database are already set
$launch = LTI_Message_Launch::from_cache($launchId, $database, new Cache());
// exit if this is not a deep link request
if (!$launch->is_deep_link_launch()) {
return '';
}
// else, setup a resource response
$resource = new LTI_Deep_Link_Resource();
$resource->set_type('link');
$resource->set_custom_params(['iframe' => ['src' => 'https://google.com']]);
// and return the response JWT, this is where it errors
return $launch->get_deep_link()->get_response_jwt([$resource]);
The README seems to imply you can generate a deep link response from a deep link request launch, but I cannot seem to make it work.