This issue occurs when the wrong "Public Key Type" option is selected on the "External Tool Configuration is selected" on Moodle.
Symptom
The error can be seen when the Public Key Type wasn't changed and no public key when doing the LTI integration in Moodle. If the Public key is not correct, one of the following messages will show.
- Exception - Argument 1 passed to Firebase \ JWT \ JWK :: parseKeySet () must be of the type array
- Warning: openssl_verify(): supplied key param cannot be coerced into a public key in ./lib/phpjwt/src/JWT.php
Solution
To fix this, follow these steps:
On Moodle go to site administrator -> Plugins -> Activity Modules -> Manage Activities -> External Tools, find the tool that is causing you the issue, and, then click Settings -> now change the Public key type from "Keyset URL" to "RSA Keys".
To find the "Public Key", go back to H5P.com -> Manage Organization -> Connect to LMS -> Find the LMS you are using and click on the public link URL.
The Public Key should open a new page and show something like this
-----BEGIN PUBLIC KEY----- MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA6clwMZtaGwpr40SRo2yH kmPIJVXRvwlL9Gx/k1ni2xKiov/LqV+YmU8NTQMUN2YcI7mxFu0t8CeAjuYLCFcb e4W72BBlaouFOKSPGsofd4pd3Ex6hodR6driRPyHH0C0eRlGh+JR8Ivh5+cEBwyc 0ULgnX+ldBsdgelvW4ovuetrwy058zdY6vjQh80pCLXwgYNewh2nk7UCEgQSsW7J JZXfKQhVtFHxjnLY3e7Bi/9piNP5weFr3gumc3tzTxixK/ySvXs7Yg1AZi4oM/GQ 2uNjxae73KfROhD58I4aANX/z6LUwegrC7bveHxqfnrNxbL0uBxz7Hksooa5zvr3 iwIDAQAB -----END PUBLIC KEY-----