Skip to content
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

example/platform/return.php: ../keys.php: failed to open stream (file does not exist) #20

Open
hanleybrand opened this issue Aug 5, 2019 · 1 comment

Comments

@hanleybrand
Copy link

hanleybrand commented Aug 5, 2019

Trying to get the example apps up and running, example isn't working because a file is missing (/example/keys.php) - calls to example/platform/return.php result in following error:

Warning: require_once(../keys.php): failed to open stream: No such file or directory in /srv/app/example/platform/return.php on line 2

Fatal error: require_once(): Failed opening required '../keys.php' (include_path='.:/usr/local/lib/php') in /srv/app/example/platform/return.php on line 2

(this is on a local machine after invoking docker-compose up --build

Is this a file that was meant to be created by the end user or is it just missing?

Creating example/keys.php and either creating a variable called $privateKey that does not contain a valid key (e.g. $privateKey = "blahblah";) or omitting that variable entirely will cause an error:

Warning: openssl_sign(): supplied key param cannot be coerced into a private key in /srv/app/lti/jwt/src/JWT.php on line 199

Fatal error: Uncaught DomainException: OpenSSL unable to sign data in /srv/app/lti/jwt/src/JWT.php:201 Stack trace: #0 /srv/app/lti/jwt/src/JWT.php(170): Firebase\JWT\JWT::sign('eyJ0eXAiOiJKV1Q...', 'blahblah', 'RS256') #1 /srv/app/example/platform/return.php(88): Firebase\JWT\JWT::encode(Array, 'blahblah', 'RS256', 'C_nvQUsUmo04et4...') #2 {main} thrown in /srv/app/lti/jwt/src/JWT.php on line 201
alternatively ... Firebase\JWT\JWT::encode(Array, NULL, 'RS256', ....

If the created keys.php does provide a valid key then the form POSTs to /example/platform/launch.php incorrectly (running via docker it attempts to post to http://localhost:9001/example/platform/launch.php rather than http://localhost:9001/example/launch.php) - if the form is corrected to action="../launch.php" it still doesn't work if $_REQUEST['state'] is null (this is probably fine for an example app tho)

@MartinLenord
Copy link
Collaborator

hmm, looks like the standard example is a bit out of date, i should probably remove it as it isn't as helpful as the other example. Have you tried the game_example launch, you may have better luck with that one

snake pushed a commit to snake/lti-1-3-php-library that referenced this issue Jan 19, 2022
ONCALL-216: Implement invalid token retry.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants